0

is it possible to use a database created in a Azure VM as a data source for model which is created in Azure Analysis Services?

So far, when I specify connection properties for the model in the web designer and test connection, I get an error stating "a connection was successfully established with the server, but then an error occurred during the login process. (provider SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)

I can connect to the server via SSMS and via RDP. I created a self-signed certificate in the azure key vault and was able to make the SQL server use it. However I can't seem to find out how to make use of it when connecting the model.

Does anyone know if it's possible and if so, what should I do to make it work?

MartinC
  • 1
  • 1
  • Clue is in the certificate error, try here: https://stackoverflow.com/questions/17615260/the-certificate-chain-was-issued-by-an-authority-that-is-not-trusted-when-conn – TJB Feb 20 '19 at 15:33
  • Thanks, this pointed me in the right direction :) – MartinC Feb 21 '19 at 22:11

1 Answers1

0

In the end I managed to make it work. For anyone with similar problem, I will write my solution below.

For the error "The certificate chain was issued by an authority that is not trusted" - just as discussed in the thread linked by TJB in comment, this was because I did not have a CA signed certificate, but a self-signed one.

A CA signed certificate from Azure would probably solve the issue, but I tried the Let's Encrypt site (also linked in the other thread). The issue I had with Let's Encrypt was that I had a windows server, while they natively support linux-based systems. However I found an article by Daniel Hutmacher called Encrypting SQL Server connections with Let’s Encrypt certificates which was solving the very issue I had. (as for the client tool, the current version is different from the one described in the article, but you can still download the old version on github. I used the lastest november 2017 release). With this I was able to generate and add a CA signed certificate to SQL server.

At this point, I created a model in Azure Analytics Services, used Azure Database as type of source/connection and filled in the connection to my VM SQL server. I saw my database tables, but when I tried to query data, I got a new error, stating that the AAS need an On-premise data gateway set up.

The Microsoft docs Install and configure an on-premises data gateway describes how to install on-premise data gateway on the VM, but if you are like me and use personal account for azure, you will have issues binding your account to the gateway. The solution as hinted here is to create a new account in Azure Active Directory (I created a new user and registered it under my azure custom domain, so the login looked like XXX@zzz.onmicrosoft.com). I gave the user admin role, so as to temporarily avoid any azure permission setbacks. Next I added the user to my subscription via Subscriptions -> "My_subscription" -> Access Control (IAM) and assigned an owner role to the AD user.

Now back on my VM I could bind the new user's account to the gateway (don't forget to change the gateway's region to your preferred region before finishing the setup).

Next, on Azure I created an "on-premise data gateway" service (do note you need to select same region as the one which your VM gateway is located under). I am not sure now, if only the new AD user I created could see the gateway, so in case you do not see it, try the AD user as well.

Last but not least, in the Azure Analytics services I went to the "on-premises data gateway" settings and set it to use the one I just created.

With this I was able to create the model and query the data from database.

Note: In the model web designed for analytics services I happened to be logged in under the AD user, not under my personal account. Attempting to change the account to my personal one ended up in login failure, however after a few such attempts and opening multiple web designers in separated tabs, I correctly logged in under my personal account. After a while I could no longer replicate the issue.

I guess the issue may have been that I was logged in to Azure under both my personal account and the AD user at the same time in same browser when setting eveything up.

MartinC
  • 1
  • 1
  • You shouldn't need a gateway at all. AAS should be able to connect directly to the SQL Server VM as long as there is network connectivity. But it seems like if everything is not set up perfectly, AAS will (think) it requires a gateway – Nick.Mc Feb 22 '19 at 04:10
  • The AAS was able to connect to SQL server and see the database schema, but strangely was unable to query the data without the gateway. It would be great if I could just skip the whole gateway process. – MartinC Feb 22 '19 at 07:39
  • Interesting. I had exactly the same problem but couldn’t solve it. It’s unfortunate that there are no further clues. – Nick.Mc Feb 22 '19 at 07:46