Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create DefaultAzureCredential for Azure SDK for .NET
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