NOTE: This approach only works when you have SQL authentication enabled on your Azure SQL server, which is not the recommended practice. However, I don’t have yet gotten the Power Automate Desktop to connect successfully to Azure SQL db any other way. If you have a working example of connecting to Azure SQL with MFA-enabled accounts, please let me know.
Power Automate Desktop has 3 actions that you can use with Azure SQL:
These are quite self-explanatory. The trickiest part in connecting to the db is defining the connection string correctly. There’s an editor in the PAD itself, but I’m always struggling to get the settings right. Now that we try to connect to Azure SQL, the easiest way is just to go to Azure and copy the connection string from there.
- Navigate to the SQL database in Azure
- Choose Connection Strings
- Click on the ODBC tab
- Copy the first one
- (You might need to change the driver number 18 to 17, highlighted in green)
- Add user name and password to the connection string
In PAD, just copy and paste the string to Open the SQL connection action and you might want to sanitize the username and password. The end result looks like this:
I’m using this approach to create a log table for my automation, which is super convenient to connect with Power BI to create a monitoring dashboard.