liprec / vsts-release-aas

Repository for my Analysis Service Azure pipelines tasks related to Azure Analysis Service or Power BI Premium
Other
27 stars 28 forks source link

Connection string not being changed during deployment #8

Closed simplesi closed 5 years ago

simplesi commented 6 years ago

My connection string isn't being changed during the deployment, despite the variables being set, and me using an Azure SQL Database.

Here's the relevant part of the .bim file:

"model": {
    "culture": "en-US",
    "dataSources": [
      {
        "name": "SqlAzure redacted.database.windows.net DW",
        "connectionString": "Data Source=redacted.database.windows.net;Initial Catalog=DW;Persist Security Info=true;User ID=devpowerbi_read;Encrypt=True;TrustServerCertificate=False;Authentication=Sql Password",
        "impersonationMode": "impersonateServiceAccount",
        "provider": "System.Data.SqlClient",
        "annotations": [
          {
            "name": "ConnectionEditUISource",
            "value": "SqlAzure"
          }
        ]
      }
    ],

However, the ApplySQLSecurity Powershell function appears to be looking for a .type element in the json which isn't there. Is there something I need to do to get Visual Studio to add this element - or can the powershell be fixed to remove this criteria?

Here's the line in question: https://github.com/liprec/vsts-release-aas/blob/7b8dc8d6efbda5e27197e2c57d5073dd06ab1fb5/deploy-aas-db/1.1.2/deploy-aas-db.psm1#L121

liprec commented 6 years ago

The extension can only handle 1400 model definitions which contains newly defined datasource definitions. See https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-compat-level for some more details. If it is no problem to change the compatibility level of your model, it will release properly. Or else I have to add the options to handle 1200 models.

Jordi-f commented 6 years ago

Hi @liprec ,

We still need to update the data source and credentials manually. Compatibility set to 1400 and source database is Azure SQL Datawarehouse. Any idea?

liprec commented 6 years ago

@Jordi-f, can you validate that in the .BIM has the 'type' attribute as part of the dataSources node? This is needed and is used to replace the server/username/password during deployment.

"dataSources": [
      {
        "type": "structured",...
Jordi-f commented 6 years ago

@liprec the "type" is not present in the .bim file, that will cause the deployment to leave the connectionstring then. Adding it to the json file did not work. This is probably due to the fact that we are still using visual studio 2015 ? In visual studio 2017 I just checked with a newer tabular model and the type tag is present there. Time to upgrade...

vamc462 commented 6 years ago

@liprec We are experiencing the same issue. The connection string does not get updated during deployment. This makes the extension being not useful if we have several environments as the data source always remains the same. We also tried specifying type: "structured" and removed 'connectionstring' and 'impersonationmode' in the .bim file, but we get the following error.

image

Also the function 'ApplySqlSecurity' in deploy-aas-db.psm1 file(line 121) checks for the if condition based on type, but type is a string value and not a boolean as per your suggestion, How will the if evaluate to a boolean. Can you please help us on this issue.

hoffe86 commented 6 years ago

@liprec We are also facing this issue. When downloading the model from azure portal the initial connection string is configured.

liprec commented 6 years ago

The extension is original created with AAS and the new 1400 compability mode in mind and those models are using the new 'modern data sources', eg 'Power Query': https://azure.microsoft.com/en-us/blog/using-modern-data-sources-in-azure-analysis-services/ or https://azure.microsoft.com/en-us/blog/1400-models-in-azure-as/ And the extension only checks if the new data sources definition is available, but doesn't warn if it is not. I want to rewrite the extension, but I am still waiting for Power BI team to open the API/XMLA endpoints so I can also incorporate that scenario with the same extension.

Till then it is possible to manually change the JSON definition to be using the new definition or as @hoffe86 is confirming: downloading the model from the Azure Portal / AAS.

liprec commented 5 years ago

Will close the issue for now. If this is still an issue, please reopen the issue and provide the requested information.