Skip to content

Commit 8ae8993

Browse files
committed
move description
1 parent 52f95e9 commit 8ae8993

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

articles/app-service/includes/tutorial-connect-msi-azure-database/code-sql-mi.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ For more information, see [Connect using Microsoft Entra authentication](/sql/co
8585
server = os.getenv('AZURE_SQL_SERVER')
8686
port = os.getenv('AZURE_SQL_PORT')
8787
database = os.getenv('AZURE_SQL_DATABASE')
88-
authentication = os.getenv('AZURE_SQL_AUTHENTICATION')
88+
authentication = os.getenv('AZURE_SQL_AUTHENTICATION') # The value should be 'ActiveDirectoryMsi'
8989
9090
# Uncomment the following lines according to the authentication type.
9191
# For system-assigned managed identity.
@@ -97,7 +97,7 @@ For more information, see [Connect using Microsoft Entra authentication](/sql/co
9797
9898
conn = pyodbc.connect(connString)
9999
```
100-
Refer to [Migrate a Python application to use passwordless connections with Azure SQL Database](/azure/azure-sql/database/azure-sql-passwordless-migration-python) to connect to Azure SQL Database using an access token.
100+
For an alternative method, you can also connect to Azure SQL Database using an access token, refer to [Migrate a Python application to use passwordless connections with Azure SQL Database](/azure/azure-sql/database/azure-sql-passwordless-migration-python).
101101
102102
### [NodeJS](#tab/nodejs)
103103
@@ -135,13 +135,11 @@ For more information, see [Connect using Microsoft Entra authentication](/sql/co
135135
// port,
136136
// database,
137137
// authentication: {
138-
// type: authenticationType,
139-
// options: {
140-
// clientId: clientId
141-
// }
138+
// type: authenticationType
142139
// },
143140
// options: {
144-
// encrypt: true
141+
// encrypt: true,
142+
// clientId: clientId
145143
// }
146144
// };
147145

articles/app-service/tutorial-connect-msi-azure-database.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,26 +188,30 @@ If you encounter any problem when creating a connection, refer to [Troubleshooti
188188
189189
## 3. Modify your code
190190
191-
In this section, connectivity to the Azure database in your code follows the `DefaultAzureCredential` pattern for all language stacks. `DefaultAzureCredential` is flexible enough to adapt to both the development environment and the Azure environment. When running locally, it can retrieve the logged-in Azure user from the environment of your choice (Visual Studio, Visual Studio Code, Azure CLI, or Azure PowerShell). When running in Azure, it retrieves the managed identity. So it's possible to have connectivity to database both at development time and in production. The pattern is as follows:
192-
193-
1. Instantiate a `DefaultAzureCredential` from the Azure Identity client library. If you're using a user-assigned identity, specify the client ID of the identity.
194-
2. Get an access token for the resource URI respective to the database type.
195-
* For Azure SQL Database: `https://database.windows.net/.default`
196-
* For Azure Database for MySQL: `https://ossrdbms-aad.database.windows.net/.default`
197-
* For Azure Database for PostgreSQL: `https://ossrdbms-aad.database.windows.net/.default`
198-
3. Add the token to your connection string.
199-
4. Open the connection.
200-
201191
# [Azure SQL Database](#tab/sqldatabase-sc)
202192
203193
[!INCLUDE [code sample for sql managed identity authentication connection](./includes/tutorial-connect-msi-azure-database/code-sql-mi.md)]
204194
205195
# [Azure Database for MySQL](#tab/mysql-sc)
206196
197+
Connectivity to the Azure Database for MySQL in your code follows the `DefaultAzureCredential` pattern for all language stacks. `DefaultAzureCredential` is flexible enough to adapt to both the development environment and the Azure environment. When running locally, it can retrieve the logged-in Azure user from the environment of your choice (Visual Studio, Visual Studio Code, Azure CLI, or Azure PowerShell). When running in Azure, it retrieves the managed identity. So it's possible to have connectivity to database both at development time and in production. The pattern is as follows:
198+
199+
1. Instantiate a `DefaultAzureCredential` from the Azure Identity client library. If you're using a user-assigned identity, specify the client ID of the identity.
200+
2. Get an access token for Azure Database for MySQL: `https://ossrdbms-aad.database.windows.net/.default`.
201+
3. Add the token to your connection string.
202+
4. Open the connection.
203+
207204
[!INCLUDE [code sample for mysql managed identity authentication connection](./includes/tutorial-connect-msi-azure-database/code-mysql-mi.md)]
208205
209206
# [Azure Database for PostgreSQL](#tab/postgresql-sc)
210207
208+
Connectivity to the Azure Database for PostgreSQL in your code follows the `DefaultAzureCredential` pattern for all language stacks. `DefaultAzureCredential` is flexible enough to adapt to both the development environment and the Azure environment. When running locally, it can retrieve the logged-in Azure user from the environment of your choice (Visual Studio, Visual Studio Code, Azure CLI, or Azure PowerShell). When running in Azure, it retrieves the managed identity. So it's possible to have connectivity to database both at development time and in production. The pattern is as follows:
209+
210+
1. Instantiate a `DefaultAzureCredential` from the Azure Identity client library. If you're using a user-assigned identity, specify the client ID of the identity.
211+
2. Get an access token for Azure Database for PostgreSQL: `https://ossrdbms-aad.database.windows.net/.default`.
212+
3. Add the token to your connection string.
213+
4. Open the connection.
214+
211215
[!INCLUDE [code sample for postgres managed identity authentication connection](./includes/tutorial-connect-msi-azure-database/code-postgres-mi.md)]
212216
213217
-----

0 commit comments

Comments
 (0)