@@ -251,8 +251,8 @@ In this section, connectivity to the Azure database in your code follows the `De
251
251
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.
252
252
1. Get an access token for the resource URI respective to the database type.
253
253
- For Azure SQL Database: `https://database.windows.net/.default`
254
- - For Azure Database for MySQL: `https://ossrdbms-aad.database.windows.net`
255
- - For Azure Database for PostgreSQL: `https://ossrdbms-aad.database.windows.net`
254
+ - For Azure Database for MySQL: `https://ossrdbms-aad.database.windows.net/.default `
255
+ - For Azure Database for PostgreSQL: `https://ossrdbms-aad.database.windows.net/.default `
256
256
1. Add the token to your connection string.
257
257
1. Open the connection.
258
258
@@ -319,7 +319,7 @@ For Azure Database for MySQL and Azure Database for PostgreSQL, the database use
319
319
//var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions { ManagedIdentityClientId = '<client-id-of-user-assigned-identity>' }); // user-assigned identity
320
320
321
321
// Get token for Azure Database for MySQL
322
- var token = credential.GetToken(new Azure.Core.TokenRequestContext(new[] { "https://ossrdbms-aad.database.windows.net" }));
322
+ var token = credential.GetToken(new Azure.Core.TokenRequestContext(new[] { "https://ossrdbms-aad.database.windows.net/.default " }));
323
323
324
324
// Set MySQL user depending on the environment
325
325
string user;
@@ -351,7 +351,7 @@ For Azure Database for MySQL and Azure Database for PostgreSQL, the database use
351
351
//var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions { ManagedIdentityClientId = '<client-id-of-user-assigned-identity>' }); // user-assigned identity
352
352
353
353
// Get token for Azure Database for PostgreSQL
354
- var token = credential.GetToken(new Azure.Core.TokenRequestContext(new[] { "https://ossrdbms-aad.database.windows.net" }));
354
+ var token = credential.GetToken(new Azure.Core.TokenRequestContext(new[] { "https://ossrdbms-aad.database.windows.net/.default " }));
355
355
356
356
// Check if in Azure and set user accordingly
357
357
string postgresqlUser;
@@ -431,7 +431,7 @@ For Azure Database for MySQL and Azure Database for PostgreSQL, the database use
431
431
//var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions { ManagedIdentityClientId = '<client-id-of-user-assigned-identity>' }); // user-assigned identity
432
432
433
433
// Get token for Azure Database for MySQL
434
- var token = credential.GetToken(new Azure.Core.TokenRequestContext(new[] { "https://ossrdbms-aad.database.windows.net" }));
434
+ var token = credential.GetToken(new Azure.Core.TokenRequestContext(new[] { "https://ossrdbms-aad.database.windows.net/.default " }));
435
435
436
436
// Set MySQL user depending on the environment
437
437
string user;
@@ -465,7 +465,7 @@ For Azure Database for MySQL and Azure Database for PostgreSQL, the database use
465
465
//var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions { ManagedIdentityClientId = '<client-id-of-user-assigned-identity>' }); // user-assigned identity
466
466
467
467
// Get token for Azure Database for PostgreSQL
468
- var token = credential.GetToken(new Azure.Core.TokenRequestContext(new[] { "https://ossrdbms-aad.database.windows.net" }));
468
+ var token = credential.GetToken(new Azure.Core.TokenRequestContext(new[] { "https://ossrdbms-aad.database.windows.net/.default " }));
469
469
470
470
// Check if in Azure and set user accordingly
471
471
string postgresqlUser;
@@ -563,7 +563,7 @@ For Azure Database for MySQL and Azure Database for PostgreSQL, the database use
563
563
//const credential = new DefaultAzureCredential({ managedIdentityClientId: '<client-id-of-user-assigned-identity>' }); // user-assigned identity
564
564
565
565
// Get token for Azure Database for MySQL
566
- const accessToken = await credential.getToken("https://ossrdbms-aad.database.windows.net");
566
+ const accessToken = await credential.getToken("https://ossrdbms-aad.database.windows.net/.default ");
567
567
568
568
// Set MySQL user depending on the environment
569
569
if(process.env.IDENTITY_ENDPOINT) {
@@ -617,7 +617,7 @@ For Azure Database for MySQL and Azure Database for PostgreSQL, the database use
617
617
//const credential = new DefaultAzureCredential({ managedIdentityClientId: '<client-id-of-user-assigned-identity>' }); // user-assigned identity
618
618
619
619
// Get token for Azure Database for PostgreSQL
620
- const accessToken = await credential.getToken("https://ossrdbms-aad.database.windows.net");
620
+ const accessToken = await credential.getToken("https://ossrdbms-aad.database.windows.net/.default ");
621
621
622
622
// Set PosrgreSQL user depending on the environment
623
623
if(process.env.IDENTITY_ENDPOINT) {
@@ -719,7 +719,7 @@ For Azure Database for MySQL and Azure Database for PostgreSQL, the database use
719
719
#credential = DefaultAzureCredential(managed_identity_client_id='<client-id-of-user-assigned-identity>') # user-assigned identity
720
720
721
721
# Get token for Azure Database for MySQL
722
- token = credential.get_token("https://ossrdbms-aad.database.windows.net")
722
+ token = credential.get_token("https://ossrdbms-aad.database.windows.net/.default ")
723
723
724
724
# Set MySQL user depending on the environment
725
725
if 'IDENTITY_ENDPOINT' in os.environ:
@@ -754,7 +754,7 @@ For Azure Database for MySQL and Azure Database for PostgreSQL, the database use
754
754
#credential = DefaultAzureCredential(managed_identity_client_id='<client-id-of-user-assigned-identity>') # user-assigned identity
755
755
756
756
# Get token for Azure Database for PostgreSQL
757
- token = credential.get_token("https://ossrdbms-aad.database.windows.net")
757
+ token = credential.get_token("https://ossrdbms-aad.database.windows.net/.default ")
758
758
759
759
# Set PostgreSQL user depending on the environment
760
760
if 'IDENTITY_ENDPOINT' in os.environ:
@@ -884,7 +884,7 @@ For Azure Database for MySQL and Azure Database for PostgreSQL, the database use
884
884
885
885
// Get the token
886
886
TokenRequestContext request = new TokenRequestContext();
887
- request.addScopes("https://ossrdbms-aad.database.windows.net");
887
+ request.addScopes("https://ossrdbms-aad.database.windows.net/.default ");
888
888
AccessToken token=creds.getToken(request).block();
889
889
890
890
// Set MySQL user depending on the environment
@@ -930,7 +930,7 @@ For Azure Database for MySQL and Azure Database for PostgreSQL, the database use
930
930
931
931
// Get the token
932
932
TokenRequestContext request = new TokenRequestContext();
933
- request.addScopes("https://ossrdbms-aad.database.windows.net");
933
+ request.addScopes("https://ossrdbms-aad.database.windows.net/.default ");
934
934
AccessToken token=creds.getToken(request).block();
935
935
936
936
// Set PostgreSQL user depending on the environment
0 commit comments