获取Azure高级存储帐户属性 [英] Get Azure premium storage account properties
问题描述
我正在尝试使用下一种方法获取高级存储帐户(经典)属性:
I am trying to get premium storage account (classic) properties using next method:
public ServiceProperties GetStorageAccountProperties(string accountName, string accountKey)
{
var connectionString = string.Format("DefaultEndpointsProtocol=http;AccountName={0};AccountKey={1};", accountName, accountKey);
var account = CloudStorageAccount.Parse(connectionString);
CloudBlobClient bloblClient = account.CreateCloudBlobClient();
return bloblClient.GetServiceProperties();
}
但是,它引发了StorageException: 远程服务器返回错误:(400)错误的请求. 扩展错误信息包含:请求URI中指定的查询参数之一的值无效. (QueryParameterName = restype QueryParameterValue = service) 此方法可与其他标准(经典)帐户配合使用.
But, it throws a StorageException: The remote server returned an error: (400) Bad Request. The extended error information contains: Value for one of the query parameters specified in the request URI is invalid. (QueryParameterName=restype QueryParameterValue=service) This method works fine with other standard (classic) accounts.
也许是由于高级存储帐户的限制.但是,如何使用CloudBlobClient处理这种类型的存储帐户?
Perhaps, it's because of the limitations of the premium storage account. But how can I use CloudBlobClient for work with this type of storage account?
推荐答案
GetServiceProperties
使 Get Blob Service Properties
REST API调用,用于获取CORS
和Storage Analytics
设置.由于Premium
存储帐户不支持CORS
和Storage Analytics
,因此会出现此错误.
GetServiceProperties
makes Get Blob Service Properties
REST API call which is used to get CORS
and Storage Analytics
setting. As both CORS
and Storage Analytics
are not supported for Premium
storage account, you're getting this error.
但是我如何使用CloudBlobClient处理这种类型的存储 帐户?
But how can I use CloudBlobClient for work with this type of storage account?
您可以将CloudBlobClient
用于高级存储帐户上所有受支持的操作.例如,您可以为Blob Container
创建引用,并使用该引用创建容器.
You can use CloudBlobClient
for all supported operations on a Premium Storage Account. For example, you can create a reference for a Blob Container
and create a container using that.
这篇关于获取Azure高级存储帐户属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!