Skip to content

Commit b603606

Browse files
authored
Merge pull request #106839 from mattchenderson/sqlmsi
making instructions for user-assigned to SQL clearer
2 parents 5a7b3e2 + 0d4ee6a commit b603606

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

articles/app-service/app-service-web-tutorial-connect-msi.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ In *Web.config*, working from the top of the file and make the following changes
122122

123123
- Find the connection string called `MyDbConnection` and replace its `connectionString` value with `"server=tcp:<server-name>.database.windows.net;database=<db-name>;UID=AnyString;Authentication=Active Directory Interactive"`. Replace _\<server-name>_ and _\<db-name>_ with your server name and database name.
124124

125+
> [!NOTE]
126+
> The SqlAuthenticationProvider you just registered is based on top of the AppAuthentication library you installed earlier. By default, it uses a system-assigned identity. To leverage a user-assigned identity, you will need to provide an additional configuration. Please see [connection string support](../key-vault/service-to-service-authentication.md#connection-string-support) for the AppAuthentication library.
127+
125128
That's every thing you need to connect to SQL Database. When debugging in Visual Studio, your code uses the Azure AD user you configured in [Set up Visual Studio](#set-up-visual-studio). You'll set up the SQL Database server later to allow connection from the managed identity of your App Service app.
126129

127130
Type `Ctrl+F5` to run the app again. The same CRUD app in your browser is now connecting to the Azure SQL Database directly, using Azure AD authentication. This setup lets you run database migrations from Visual Studio.
@@ -184,6 +187,9 @@ Type `Ctrl+F5` to run the app again. The same CRUD app in your browser is now co
184187

185188
Next, you configure your App Service app to connect to SQL Database with a system-assigned managed identity.
186189

190+
> [!NOTE]
191+
> While the instructions in this section are for a system-assigned identity, a user-assigned identity can just as easily be used. To do this. you would need the change the `az webapp identity assign command` to assign the desired user-assigned identity. Then, when creating the SQL user, make sure to use the name of the user-assigned identity resource rather than the site name.
192+
187193
### Enable managed identity on app
188194

189195
To enable a managed identity for your Azure app, use the [az webapp identity assign](/cli/azure/webapp/identity?view=azure-cli-latest#az-webapp-identity-assign) command in the Cloud Shell. In the following command, replace *\<app-name>*.
@@ -232,7 +238,7 @@ ALTER ROLE db_ddladmin ADD MEMBER [<identity-name>];
232238
GO
233239
```
234240

235-
*\<identity-name>* is the name of the managed identity in Azure AD. Since it's system-assigned, it's always the same as the name of your App Service app. To grant permissions for an Azure AD group, use the group's display name instead (for example, *myAzureSQLDBAccessGroup*).
241+
*\<identity-name>* is the name of the managed identity in Azure AD. If the identity is system-assigned, the name always the same as the name of your App Service app. To grant permissions for an Azure AD group, use the group's display name instead (for example, *myAzureSQLDBAccessGroup*).
236242

237243
Type `EXIT` to return to the Cloud Shell prompt.
238244

0 commit comments

Comments
 (0)