Update-AzStorageBlobServiceProperty
Modifies the service properties for the Azure Storage Blob service.
Syntax
Update-AzStorageBlobServiceProperty
[-ResourceGroupName] <String>
[-StorageAccountName] <String>
[-DefaultServiceVersion <String>]
[-EnableChangeFeed <Boolean>]
[-ChangeFeedRetentionInDays <Int32>]
[-IsVersioningEnabled <Boolean>]
[-CorsRule <PSCorsRule[]>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Update-AzStorageBlobServiceProperty
-StorageAccount <PSStorageAccount>
[-DefaultServiceVersion <String>]
[-EnableChangeFeed <Boolean>]
[-ChangeFeedRetentionInDays <Int32>]
[-IsVersioningEnabled <Boolean>]
[-CorsRule <PSCorsRule[]>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Update-AzStorageBlobServiceProperty
[-ResourceId] <String>
[-DefaultServiceVersion <String>]
[-EnableChangeFeed <Boolean>]
[-ChangeFeedRetentionInDays <Int32>]
[-IsVersioningEnabled <Boolean>]
[-CorsRule <PSCorsRule[]>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Update-AzStorageBlobServiceProperty cmdlet modifies the service properties for the Azure Storage Blob service.
Examples
Example 1: Set Blob service DefaultServiceVersion to 2018-03-28
Update-AzStorageBlobServiceProperty -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -DefaultServiceVersion 2018-03-28
StorageAccountName : mystorageaccount
ResourceGroupName : myresourcegroup
DefaultServiceVersion : 2018-03-28
DeleteRetentionPolicy.Enabled : False
DeleteRetentionPolicy.Days :
RestorePolicy.Enabled :
RestorePolicy.Days :
ChangeFeed.Enabled :
ChangeFeed.RetentionInDays :
IsVersioningEnabled :
This command sets the DefaultServiceVersion of Blob Service to 2018-03-28.
Example 2: Enable Changefeed on Blob service of a Storage account with ChangeFeedRetentionInDays as 5 days
Update-AzStorageBlobServiceProperty -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -EnableChangeFeed $true -ChangeFeedRetentionInDays 5
StorageAccountName : mystorageaccount
ResourceGroupName : myresourcegroup
DefaultServiceVersion :
DeleteRetentionPolicy.Enabled : False
DeleteRetentionPolicy.Days :
RestorePolicy.Enabled :
RestorePolicy.Days :
ChangeFeed.Enabled : True
ChangeFeed.RetentionInDays : 5
IsVersioningEnabled :
This command enables Changefeed on Blob service of a Storage account with ChangeFeedRetentionInDays as 5 days. Change feed support in Azure Blob Storage works by listening to a GPv2 or Blob storage account for any blob level creation, modification, or deletion events. It then outputs an ordered log of events for the blobs stored in the $blobchangefeed container within the storage account. The serialized changes are persisted as an Apache Avro file and can be processed asynchronously and incrementally. If not specify ChangeFeedRetentionInDays, will get null value in service properties, indicates an infinite retention of the change feed.
Example 3: Enable Versioning on Blob service of a Storage account
Update-AzStorageBlobServiceProperty -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -IsVersioningEnabled $true
StorageAccountName : mystorageaccount
ResourceGroupName : myresourcegroup
DefaultServiceVersion :
DeleteRetentionPolicy.Enabled : False
DeleteRetentionPolicy.Days :
RestorePolicy.Enabled :
RestorePolicy.Days :
ChangeFeed :
ChangeFeed.RetentionInDays :
IsVersioningEnabled : True
This command enables Versioning on Blob service of a Storage account
Example 4: Update CORS rules
$CorsRules = (@{
AllowedHeaders=@("x-ms-blob-content-type","x-ms-blob-content-disposition");
ExposedHeaders=@();
AllowedOrigins=@("*");
AllowedMethods=@("TRACE","CONNECT")},
@{
AllowedOrigins=@("http://www.fabrikam.com","http://www.contoso.com");
ExposedHeaders=@("x-ms-meta-data*","x-ms-meta-customheader");
AllowedHeaders=@("x-ms-meta-target*","x-ms-meta-customheader");
MaxAgeInSeconds=30;
AllowedMethods=@("PUT")})
$property = Update-AzStorageBlobServiceProperty -ResourceGroupName myresourcegroup -StorageAccountName mystorageaccount -CorsRule $CorsRules
$property.Cors.CorsRulesProperty
AllowedOrigins : {*}
AllowedMethods : {TRACE, CONNECT}
MaxAgeInSeconds : 0
ExposedHeaders : {}
AllowedHeaders : {x-ms-blob-content-type, x-ms-blob-content-disposition}
AllowedOrigins : {http://www.fabrikam.com, http://www.contoso.com}
AllowedMethods : {PUT}
MaxAgeInSeconds : 30
ExposedHeaders : {x-ms-meta-customheader, x-ms-meta-data*}
AllowedHeaders : {x-ms-meta-customheader, x-ms-meta-target*}
The first command assigns an array of rules to the $CorsRules variable. This command uses standard extends over several lines in this code block. The second command sets the rules in $CorsRules to the Blob service of a Storage account.
Example 5: Clean up CORS rules
Update-AzStorageBlobServiceProperty -ResourceGroupName myresourcegroup -StorageAccountName mystorageaccount -CorsRule @()
This command cleans up the CORS rules of a Storage account by inputting @() to parameter CorsRule
Parameters
-ChangeFeedRetentionInDays
Indicates the duration of changeFeed retention in days. Minimum value is 1 day and maximum value is 146000 days (400 years). Never specify it when enabled changeFeed will get null value in service properties, indicates an infinite retention of the change feed.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CorsRule
Specifies CORS rules for the Blob service.
Type: | PSCorsRule[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultServiceVersion
Default Service Version to Set
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EnableChangeFeed
Enable Change Feed logging for the storage account by set to $true, disable Change Feed logging by set to $false.
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-IsVersioningEnabled
Gets or sets versioning is enabled if set to true.
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
Resource Group Name.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceId
Input a Storage account Resource Id, or a Blob service properties Resource Id.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageAccount
Storage account object
Type: | PSStorageAccount |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageAccountName
Storage Account Name.
Type: | String |
Aliases: | AccountName, Name |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |