Edit

Share via


Update-AzStorageBlobServiceProperty

Modifies the service properties for the Azure Storage Blob service.

Syntax

AccountName (Default)

Update-AzStorageBlobServiceProperty
    [-ResourceGroupName] <String>
    [-StorageAccountName] <String>
    [-DefaultServiceVersion <String>]
    [-EnableChangeFeed <Boolean>]
    [-ChangeFeedRetentionInDays <Int32>]
    [-IsVersioningEnabled <Boolean>]
    [-CorsRule <PSCorsRule[]>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

AccountObject

Update-AzStorageBlobServiceProperty
    -StorageAccount <PSStorageAccount>
    [-DefaultServiceVersion <String>]
    [-EnableChangeFeed <Boolean>]
    [-ChangeFeedRetentionInDays <Int32>]
    [-IsVersioningEnabled <Boolean>]
    [-CorsRule <PSCorsRule[]>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

BlobServicePropertiesResourceId

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.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CorsRule

Specifies CORS rules for the Blob service.

Parameter properties

Type:

PSCorsRule[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultServiceVersion

Default Service Version to Set

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableChangeFeed

Enable Change Feed logging for the storage account by set to $true, disable Change Feed logging by set to $false.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IsVersioningEnabled

Gets or sets versioning is enabled if set to true.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

Resource Group Name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AccountName
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceId

Input a Storage account Resource Id, or a Blob service properties Resource Id.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

BlobServicePropertiesResourceId
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-StorageAccount

Storage account object

Parameter properties

Type:PSStorageAccount
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AccountObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-StorageAccountName

Storage Account Name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AccountName, Name

Parameter sets

AccountName
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

PSStorageAccount

String

Outputs

PSBlobServiceProperties