Ask Your Question
4

How can a user-assigned managed identity be used to establish a connection between Azure App Service and Azure SQL?

asked 2022-07-07 11:00:00 +0000

nofretete gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-06-17 11:00:00 +0000

scrum gravatar image

A user-assigned managed identity can be used to establish a connection between Azure App Service and Azure SQL in the following steps:

  1. Create a user-assigned managed identity in Azure Active Directory and assign it to the App Service.
  2. Assign the managed identity the appropriate permissions in Azure SQL.
  3. Configure the App Service to use the managed identity for authentication.
  4. Modify the connection string for the App Service to include the managed identity in the "User ID" field.

Here is an example connection string:

Server=tcp:<your_db_server_name>.database.windows.net,1433;Initial Catalog=<your_db_name>;Persist Security Info=False;User ID=<your_managed_identity_name>@<your_tenant>.onmicrosoft.com;Password=XXX;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

Note that the "User ID" field includes the name of the managed identity and the tenant ID concatenated with "@". The password is not required since the managed identity is used for authentication.

With these steps completed, the App Service will be able to establish a secure connection to the Azure SQL without the need for any additional credentials.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-07-07 11:00:00 +0000

Seen: 9 times

Last updated: Jun 17 '21