File tree Expand file tree Collapse file tree 4 files changed +2
-30
lines changed
local-dev-service-principal Expand file tree Collapse file tree 4 files changed +2
-30
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
ms.topic : include
3
- ms.date : 04 /25/2025
3
+ ms.date : 07 /25/2025
4
4
---
5
5
6
6
## Authenticate to Azure services from your app
@@ -37,7 +37,3 @@ Azure services are accessed using specialized client classes from the various Az
37
37
1 . Pass an instance of ` DefaultAzureCredential ` to the ` UseCredential ` method.
38
38
39
39
:::code language="csharp" source="../snippets/authentication/local-dev-account/Program.cs" id="snippet_DefaultAzureCredential_UseCredential":::
40
-
41
- An alternative to the ` UseCredential ` method is to provide the credential to the service client directly:
42
-
43
- :::code language="csharp" source="../snippets/authentication/local-dev-account/Program.cs" id="snippet_DefaultAzureCredential":::
Original file line number Diff line number Diff line change 1
1
---
2
2
ms.topic : include
3
- ms.date : 02/12 /2025
3
+ ms.date : 07/25 /2025
4
4
---
5
5
6
6
[ !INCLUDE [ implement-service-principal-concepts] ( implement-service-principal-concepts.md )]
@@ -34,7 +34,3 @@ Azure services are accessed using specialized client classes from the various Az
34
34
1 . Pass the ` ClientSecretCredential ` instance to the ` UseCredential ` method.
35
35
36
36
:::code language="csharp" source="../snippets/authentication/local-dev-service-principal/Program.cs" id="snippet_ClientSecretCredential_UseCredential":::
37
-
38
- An alternative to the ` UseCredential ` method is to provide the credential to the service client directly:
39
-
40
- :::code language="csharp" source="../snippets/authentication/local-dev-service-principal/Program.cs" id="snippet_ClientSecretCredential":::
Original file line number Diff line number Diff line change 1
1
using Azure . Identity ;
2
2
using Microsoft . Extensions . Azure ;
3
3
using Azure . Storage . Blobs ;
4
- using Azure . Core ;
5
4
6
5
var builder = WebApplication . CreateBuilder ( args ) ;
7
6
@@ -54,13 +53,6 @@ void registerUsingServicePrincipal(WebApplicationBuilder builder)
54
53
clientBuilder . UseCredential ( new DefaultAzureCredential ( ) ) ;
55
54
} ) ;
56
55
#endregion snippet_DefaultAzureCredential_UseCredential
57
-
58
- #region snippet_DefaultAzureCredential
59
- builder . Services . AddSingleton < BlobServiceClient > ( _ =>
60
- new BlobServiceClient (
61
- new Uri ( "https://<account-name>.blob.core.windows.net" ) ,
62
- new DefaultAzureCredential ( ) ) ) ;
63
- #endregion snippet_DefaultAzureCredential
64
56
}
65
57
66
58
internal record WeatherForecast ( DateOnly Date , int TemperatureC , string ? Summary )
Original file line number Diff line number Diff line change 1
1
using Azure . Identity ;
2
2
using Microsoft . Extensions . Azure ;
3
3
using Azure . Storage . Blobs ;
4
- using Azure . Core ;
5
4
6
5
var builder = WebApplication . CreateBuilder ( args ) ;
7
6
@@ -58,17 +57,6 @@ void registerUsingServicePrincipal(WebApplicationBuilder builder)
58
57
clientBuilder . UseCredential ( new ClientSecretCredential ( tenantId , clientId , clientSecret ) ) ;
59
58
} ) ;
60
59
#endregion snippet_ClientSecretCredential_UseCredential
61
-
62
- #region snippet_ClientSecretCredential
63
- var tenantId = Environment . GetEnvironmentVariable ( "AZURE_TENANT_ID" ) ;
64
- var clientId = Environment . GetEnvironmentVariable ( "AZURE_CLIENT_ID" ) ;
65
- var clientSecret = Environment . GetEnvironmentVariable ( "AZURE_CLIENT_SECRET" ) ;
66
-
67
- builder . Services . AddSingleton < BlobServiceClient > ( _ =>
68
- new BlobServiceClient (
69
- new Uri ( "https://<account-name>.blob.core.windows.net" ) ,
70
- new ClientSecretCredential ( tenantId , clientId , clientSecret ) ) ) ;
71
- #endregion snippet_ClientSecretCredential
72
60
}
73
61
74
62
internal record WeatherForecast ( DateOnly Date , int TemperatureC , string ? Summary )
You can’t perform that action at this time.
0 commit comments