Press "Enter" to skip to content

Connecting to an Azure subscription from Azure Data Studio & Visual Studio

Identifying the permissions required for this was a case of trial & error, & some Googling until I came across a couple of Microsoft Developer Community questions that pointed me in the right direction. I’m not entirely sure why it works this way, but it does. If you have more insight, please feel free to comment!

I have a new Azure Active Directory (AAD) user named Test Developer who wants to connect to an Azure subscription from Azure Data Studio & Visual Studio so that they can develop against an Azure SQL Database. In this case, they’ve got Visual Studio 2022 installed & Azure Data Studio is up-to-date. Also Test Developer is signed into Visual Studio.

Visual Studio Account Settings window showing Test Developer is logged in

As shown, Test Developer is the Active Directory admin on the Azure SQL Server they want to connect to, so it would be reasonable to expect that the databases in that SQL Server would appear in the list of available resources in Azure Data Studio & Visual Studio.

SQL Server Overview blade in the Azure Portal showing Test Developer is the Active Directory admin

However, despite being signed into their account, Test Developer can see no Azure subscriptions or resources in Azure Data Studio.

Connections list in Azure Data Studio showing no subscriptions found for Test Developer

Likewise, they can see no subscriptions or resources in Visual Studio, either in the SQL Server Object Explorer or the Connection list.

SQL Server Object Explorer window in Visual Studio
Connections list in Visual Studio showing no subscriptions found for Test Developer

To resolve this, Test Developer’s account needs to be assigned to the classic Co-administrator role. This is achieved by accessing the Azure subscription’s Access Control (IAM) settings via the Azure Portal. In Classic Administrators, there is the option to add Co-administrators.

Subscription Overview blade in the Azure Portal showing Test Developer has been assigned the classic Co-administrator role

Note: Only one Service administrator is allowed per subscription.

After making this change, on launching Azure Data Studio, Test Developer can now see the Azure subscription & its resources, such as the Azure SQL Database they want to develop against.

Connections list in Azure Data Studio showing the Azure subscription for Test Developer

Likewise, they can see the subscription in the Visual Studio Connection list & create a connection that will appear in SQL Server Object Explorer.

Connections list in Visual Studio showing the Azure SQL Database for Test Developer
SQL Server Object Explorer window in Visual Studio showing the Azure SQL Database for Test Developer

This connection makes is easier to publish Database Projects to the database & to create Publish Profiles.

Publish Database Recent Connections window in Visual Studio showing the Azure SQL Database
Publish Database window in Visual Studio showing the Azure SQL Database as the target database connection

More information about classic administrator roles such as Service administrator & Co-administrator can be found in Microsoft’s documentation.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *