Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create AzureCredntials for Azure SDK for .NET
using Microsoft.Azure.Management.PostgreSQL.FlexibleServers;
using Microsoft.Azure.Management.ResourceManager.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent.Authentication;
using System.Threading.Tasks;
// SdkContext から生成する場合
// var cred = SdkContext.AzureCredentialsFactory.FromMSI(new MSILoginInformation(MSIResourceType.AppService), AzureEnvironment.AzureGlobalCloud);
// var cred = SdkContext.AzureCredentialsFactory.FromServicePrincipal("<clientId>", "<clientSecret>", "<tenantId>", AzureEnvironment.AzureGlobalCloud);
// new AzureCredentials でインスタンスを渡して生成する場合
var cred = new AzureCredentials(new ServicePrincipalLoginInformation
{
ClientId = "<clientid>",
ClientSecret = "<clientSecret>",
}, "<tenantid>", AzureEnvironment.AzureGlobalCloud);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment