SQL Server 2012 – Data Source Per Environment in Analysis Services Project

sql-server-2012ssas

I'm trying to configure a multi dimensional analysis service project, so that each developer of a team can configure his/her own data source (oracle).

Changing the deployment target is easy, but how do I specify which data source the project should use per configuration?

Best Answer

You don't see the data source projects in the same dialog but you can actually configure them per environment using the data source editor dialog.

For example I created an SSAS project with only a data source and only a development configuration and this is what it looks like when I open the .dwproj file in notepad:

<Project xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200" xmlns:dwd="http://schemas.microsoft.com/DataWarehouse/Designer/1.0">
  <ProductVersion>10.50.4033.0</ProductVersion>
  <SchemaVersion>9.0.2.10</SchemaVersion>
  <State></State>
  <Database>
    <Name>Analysis Services Project1.database</Name>
    <FullPath>Analysis Services Project1.database</FullPath>
  </Database>
  <DataSources>
    <ProjectItem>
      <Name>datasource.ds</Name>
      <FullPath>datasource.ds</FullPath>
    </ProjectItem>
  </DataSources>
  <Configurations>
    <Configuration>
      <Name>Development</Name>
      <Options>
        <ConnectionMappings>
          <ConfigurationSetting>
            <Id>datawarehouse/Id>
            <Name>datawarehouse</Name>
            <Value xsi:type="xsd:string">Provider=SQLNCLI10.1;Data Source=mydb;Integrated Security=SSPI;Initial Catalog=mydb</Value>
          </ConfigurationSetting>
        </ConnectionMappings>
        <ConnectionSecurityMappings>
          <ConfigurationSetting>
            <Id>datawarehouse</Id>
            <Name>datawarehouse</Name>
            <Value xsi:type="xsd:int">0</Value>
          </ConfigurationSetting>
        </ConnectionSecurityMappings>
      </Options>
    </Configuration>
  </Configurations>
</Project>

I then added a new environment using the environment dialog and changed the data source while running with my 'production' configuration.

If I then switch back between development and production configuration and view the data source properties by double clicking them in visual studio the data source changes accordingly.

If you set up an entire project you will be surprised at how much of the properties are actually stored in the .dwproj and dwproj.user configurations and all of those will be honored when you switch between configurations.

For example configuring a storage location on one of my cubes adds this:

    <CubeStorageLocations>
      <ConfigurationSetting>
        <Id>New cube</Id>
        <Name>New cube</Name>
        <Value xsi:type="xsd:string">C:\Program Files\Microsoft SQL Server\MSAS10_50.MSSQLSERVER\OLAP\Log\</Value>
      </ConfigurationSetting>
    </CubeStorageLocations>

I never tried to compile a list of things that are configurable, but if you open those 2 files in notepad you should be able to see all the properties that you can configure per environment.

These are some that I seem to remember as being able to configure:

  1. deployment target edition
  2. error log files for processing errors

EDIT: somebody pointed me to a blog post by @GregGalloway with a list of configurable settings. It's even more than I expected: Analysis Services Project Configurations

List in case the blog post dissapears:

  • ConnectionMappings
  • ConnectionProviderMappings
  • ConnectionSecurityMappings
  • CubeKeyErrorLogFiles
  • CubeStorageLocations
  • DeploymentMode
  • DeploymentServerEdition
  • DimensionKeyErrorLogFiles
  • MeasureGroupKeyErrorLogFiles
  • MiningStructureKeyErrorLogFiles
  • OutputPath
  • PartitionKeyErrorLogFiles
  • PartitionRemoteServers
  • PartitionStorageLocations
  • ProcessingOption
  • RemovePasswords
  • ReportActionPaths
  • ReportActionServers
  • StartObject
  • TargetDatabase
  • TargetServer
  • TransactionalDeployment
  • UserIDs
  • UserPasswords