drm*_*drm 1 php azure azure-blob-storage
$this->blobClient = ServicesBuilder::getInstance()
->createBlobService($azureString);
$properties = $this->blobClient->getServiceProperties();
Run Code Online (Sandbox Code Playgroud)
如何更改 microsoft azure 的默认服务版本?
当前设置为 2009-09-19。我想将其更改为 2012-02-12。
谢谢。
为了扩展 Aaron Chen 的答案,您实际上可以永久设置默认服务版本,这样您就不必提供x-ms-version请求标头来获取公共请求的更新功能(例如“ Accept-Ranges: bytes ”)例如标题)。不过这有点麻烦,因为几乎没有 SDK 实际上支持设置此属性。对我有用的是使用以下 PowerShell 代码。它仅适用于 Windows(其他平台的 DotNetCore-Azure 模块也不支持),但如果您无权访问 Windows 环境,它可以使用Azure 门户中的Cloud Shell工作。
在Cloud Shell 中:
PS Azure:\> $ctx = New-AzureStorageContext -StorageAccountName <account-name> -StorageAccountKey <key>
Azure:\
PS Azure:\> Update-AzureStorageServiceProperty -ServiceType Blob -DefaultServiceVersion 2017-07-29 -Context $ctx
Run Code Online (Sandbox Code Playgroud)
对于不提供自己的 x-ms-version 标头的所有请求,这会将存储帐户服务的默认版本设置为2017-07-29(撰写本文时的最新版本)。有关可用的不同版本的概述,请参阅此列表。
在 Windows PowerShell 环境中,您还必须安装 Azure 模块:
作为管理员:
Install-Module -Name AzureRM -AllowClobber
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Run Code Online (Sandbox Code Playgroud)
作为用户
Import-Module Azure.Storage
$ctx = New-AzureStorageContext -StorageAccountName <account-name> -StorageAccountKey <key>
Update-AzureStorageServiceProperty -ServiceType Blob -DefaultServiceVersion 2017-07-29 -Context $ctx
Run Code Online (Sandbox Code Playgroud)