Last active
July 5, 2022 16:10
-
-
Save guitarrapc/6aa3810bc84d95eefaec6980c2cfb901 to your computer and use it in GitHub Desktop.
Create AzureCredntials 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 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