【发布时间】:2018-02-09 13:51:17
【问题描述】:
我已尝试使用以下代码在 Azure 中创建新的存储帐户:
获取令牌(成功 - 我收到了令牌):
var cc = new ClientCredential("clientId", "clientSecret");
var context = new AuthenticationContext("https://login.windows.net/subscription");
var result = context.AcquireTokenAsync("https://management.azure.com/", cc);
创建云存储凭据:
var credential = new TokenCloudCredentials("subscription", token);
创建云存储帐户(失败):
using (var storageClient = new StorageManagementClient(credentials))
{
await storageClient.StorageAccounts.CreateAsync(new StorageAccountCreateParameters
{
Label = "samplestorageaccount",
Location = LocationNames.NorthEurope,
Name = "myteststorage",
AccountType = "RA-GRS"
});
}
错误:
ForbiddenError:服务器未能验证请求。核实 证书有效并与此相关联 订阅。
我不确定这是误导性消息之一,还是我在 Azure 中配置错误?
【问题讨论】:
-
请看看这是否回答了您的问题:stackoverflow.com/questions/35190866/….
-
@GauravMantri 非常感谢 - 该链接提供了获取正确标识符的见解
标签: c# azure azure-blob-storage