Created
July 5, 2022 16:01
-
-
Save guitarrapc/f8743fea82e7ed5c98b059ca6fca12cf to your computer and use it in GitHub Desktop.
Create DefaultAzureCredential for Azure SDK for .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
using Azure.Identity; | |
// ServicePrincipal なら 環境変数に仕込んで認証できる | |
// Environment.SetEnvironmentVariable("AZURE_CLIENT_ID", "<reducted>", EnvironmentVariableTarget.Process); | |
// Environment.SetEnvironmentVariable("AZURE_CLIENT_SECRET", "<reducted>", EnvironmentVariableTarget.Process); | |
// Environment.SetEnvironmentVariable("AZURE_TENANT_ID", "<reducted>", EnvironmentVariableTarget.Process); | |
// インスタンス生成はこれだけ | |
var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions { /* VSを除外したりとオプション指定 */ }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment