在C#中通过API在Azure中创建存储帐户时发生异常

时间:2015-07-09 06:51:00

标签: c# azure azure-storage

enter code here我创建了一个类,用于获取创建凭据所需的令牌,然后在使用c#an exception&#34时在azure环境中创建存储帐户;服务器无法验证请求。验证证书是否有效并与此订阅相关联#34;发生。请告诉我如何解决此问题?

 public async static Task<string> CreateStorageAccount(SubscriptionCloudCredentials credentials)
        {
            using (var storageClient = new StorageManagementClient(credentials))
            {
                await storageClient.StorageAccounts.CreateAsync(

                  new StorageAccountCreateParameters
                  {
                      AccountType = "Standard_GRS",
                      // AccountType = AccountType.StandardLRS, Location = "West US"
                      //GeoReplicationEnabled = false,
                      Label = "Sample Storage Account",
                      Location = LocationNames.EastAsia,
                      Name = ConfigurationManager.AppSettings["storageName"]
                  });
            }
            return "Successfully created account.";
        }

提前致谢

0 个答案:

没有答案