gpt4 book ai didi

php - 更改 Microsoft Azure Blob - PHP 的默认服务版本

转载 作者:行者123 更新时间:2023-12-02 06:02:04 25 4
gpt4 key购买 nike

$this->blobClient = ServicesBuilder::getInstance()
->createBlobService($azureString);

$properties = $this->blobClient->getServiceProperties();

如何更改 Microsoft Azure 的默认服务版本?

目前设定为2009年9月19日。我想把它改成2012-02-12。

谢谢。

最佳答案

要扩展陈亚伦的答案,您实际上可以 set the default service version永久,这样您就不必提供x-ms-version请求 header 来获取公共(public)请求的更新功能(例如“Accept-Ranges: bytes” header 例如)。不过这有点麻烦,因为几乎没有 SDK 实际上支持设置这个属性。对我有用的是使用以下 PowerShell 代码。它仅适用于 Windows(其他平台的 DotNetCore-Azure 模块也不支持),但如果您没有,它可以使用 Azure 门户中的Cloud Shell访问Windows环境。

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

对于所有不提供自己的 x-ms 的请求,这会将存储帐户服务的默认版本设置为 2017-07-29(撰写本文时的最新版本) -版本 header 。看这个list for an overview of the different versions available

在 Windows PowerShell 环境中,您还必须安装 Azure 模块:

作为管理员:

Install-Module -Name AzureRM -AllowClobber
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

作为用户

Import-Module Azure.Storage
$ctx = New-AzureStorageContext -StorageAccountName <account-name> -StorageAccountKey <key>
Update-AzureStorageServiceProperty -ServiceType Blob -DefaultServiceVersion 2017-07-29 -Context $ctx

关于php - 更改 Microsoft Azure Blob - PHP 的默认服务版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43335176/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com