我有一个为 Azure 构建资源的脚本。目前,我正在使用服务主体,但理想情况下,我希望使用我的 Active Directory 登录名,因为我们将向更大的开发人员群体开放脚本并希望具有可追溯性。是否可以用于InteractiveBrowserCredential
执行以下操作:
var credential = await new InteractiveBrowserCredential(new InteractiveBrowserCredentialOptions {});
var azure = Microsoft.Azure.Management.Fluent.Azure
.Configure()
.WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
.Authenticate(new AzureCredentials(credential, AzureEnvironment.AzureGlobalCloud))
.WithSubscription(subscriptionId);
var webApp = await azure.WebApps.GetByResourceGroupAsync(resourceGroup, webAppName);
上面的脚本无法编译,因为InteractiveBrowserCredential
和之间没有转换AzureCredentials
。当我从 中提取令牌时InteractiveBrowserControl
,我收到来自网络应用程序的未经授权的响应。