$this->blobClient = ServicesBuilder::getInstance()
->createBlobService($azureString);
$properties = $this->blobClient->getServiceProperties();
How can i change the default service version of microsoft azure?
Currently it is set at 2009-09-19. i want to change it to 2012-02-12.
Thanks.
To expand on Aaron Chen's answer, you can actually set the default service version permanently, so that you don't have to provide the x-ms-version request header to get newer features for public requests (like "Accept-Ranges: bytes" header for example). It is a bit of a hassle though, because almost no SDK actually supports setting this property. What worked for me is to use the following PowerShell code. It's for Windows only (the DotNetCore-Azure modules for other platforms do not support that either), but it works using the Cloud Shell within Azure Portal if you don't have access to a Windows environment.
Within 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
This will set the default version of the storage account's service to 2017-07-29 (the newest at the time of this writing) for all requests which don't provide their own x-ms-version header. See this list for an overview of the different versions available.
Within a Windows PowerShell environment you have to install the Azure modules as well:
As an admin:
Install-Module -Name AzureRM -AllowClobber
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
As a user
Import-Module Azure.Storage
$ctx = New-AzureStorageContext -StorageAccountName <account-name> -StorageAccountKey <key>
Update-AzureStorageServiceProperty -ServiceType Blob -DefaultServiceVersion 2017-07-29 -Context $ctx