Enable-AzStorageBlobRestorePolicy
Enables Blob Restore Policy on a Storage account.
Syntax
AccountName (Default)
Enable-AzStorageBlobRestorePolicy
[-ResourceGroupName] <String>
[-StorageAccountName] <String>
-RestoreDays <Int32>
[-PassThru]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
AccountObject
Enable-AzStorageBlobRestorePolicy
-StorageAccount <PSStorageAccount>
-RestoreDays <Int32>
[-PassThru]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
BlobServicePropertiesResourceId
Enable-AzStorageBlobRestorePolicy
[-ResourceId] <String>
-RestoreDays <Int32>
[-PassThru]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Enable-AzStorageBlobRestorePolicy cmdlet enables Blob Restore Policy for the Azure Storage Blob service.
Examples
Example 1: Enables Blob Restore Policy for the Azure Storage Blob service on a Storage account
Enable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -RetentionDays 5
Update-AzStorageBlobServiceProperty -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -EnableChangeFeed $true
StorageAccountName : mystorageaccount
ResourceGroupName : myresourcegroup
DefaultServiceVersion :
DeleteRetentionPolicy.Enabled : True
DeleteRetentionPolicy.Days : 5
RestorePolicy.Enabled : False
RestorePolicy.Days :
RestorePolicy.MinRestoreTime :
ChangeFeed : True
IsVersioningEnabled : True
Enable-AzStorageBlobRestorePolicy -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -RestoreDays 4
Get-AzStorageBlobServiceProperty -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount"
StorageAccountName : mystorageaccount
ResourceGroupName : myresourcegoup
DefaultServiceVersion :
DeleteRetentionPolicy.Enabled : True
DeleteRetentionPolicy.Days : 5
RestorePolicy.Enabled : True
RestorePolicy.Days : 4
RestorePolicy.MinRestoreTime : 8/28/2020 6:00:59 AM
ChangeFeed : True
IsVersioningEnabled : True
This command first enable Blob softdelete and changefeed, then enables Blob Restore Policy, finally check the setting in Blob service properties.
The Blob service RestorePolicy.Days must be smaller than DeleteRetentionPolicy.Days.
Blob softdelete and ChangeFeed must be enabled before enable blob Restore Policy.
If softdelete and Changefeed are just enabled, might need wait for some time for server to handle the setting, before enable Blob restore policy.
Parameters
-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
-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
-PassThru
Display ServiceProperties
Parameter properties
Type: SwitchParameter
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
-RestoreDays
Sets the number of days for the blob can be restored..
Parameter properties
Type: Int32
Default value: None
Supports wildcards: False
DontShow: False
Aliases: Days
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
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 .
Outputs