編集

次の方法で共有


Set-AzRmStorageContainerImmutabilityPolicy

Creates or updates ImmutabilityPolicy of a Storage blob containers

Syntax

Set-AzRmStorageContainerImmutabilityPolicy
   [-ResourceGroupName] <String>
   [-StorageAccountName] <String>
   -ContainerName <String>
   [-ImmutabilityPeriod <Int32>]
   [-AllowProtectedAppendWriteAll <Boolean>]
   [-AllowProtectedAppendWrite <Boolean>]
   [-Etag <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzRmStorageContainerImmutabilityPolicy
   [-ResourceGroupName] <String>
   [-StorageAccountName] <String>
   -ContainerName <String>
   -ImmutabilityPeriod <Int32>
   -Etag <String>
   [-ExtendPolicy]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzRmStorageContainerImmutabilityPolicy
   -ContainerName <String>
   -StorageAccount <PSStorageAccount>
   [-ImmutabilityPeriod <Int32>]
   [-AllowProtectedAppendWriteAll <Boolean>]
   [-AllowProtectedAppendWrite <Boolean>]
   [-Etag <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzRmStorageContainerImmutabilityPolicy
   -ContainerName <String>
   -StorageAccount <PSStorageAccount>
   -ImmutabilityPeriod <Int32>
   -Etag <String>
   [-ExtendPolicy]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzRmStorageContainerImmutabilityPolicy
   -Container <PSContainer>
   [-ImmutabilityPeriod <Int32>]
   [-AllowProtectedAppendWriteAll <Boolean>]
   [-AllowProtectedAppendWrite <Boolean>]
   [-Etag <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzRmStorageContainerImmutabilityPolicy
   -Container <PSContainer>
   -ImmutabilityPeriod <Int32>
   -Etag <String>
   [-ExtendPolicy]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzRmStorageContainerImmutabilityPolicy
   [-InputObject] <PSImmutabilityPolicy>
   [-ImmutabilityPeriod <Int32>]
   [-AllowProtectedAppendWriteAll <Boolean>]
   [-AllowProtectedAppendWrite <Boolean>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzRmStorageContainerImmutabilityPolicy
   [-InputObject] <PSImmutabilityPolicy>
   -ImmutabilityPeriod <Int32>
   [-ExtendPolicy]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-AzRmStorageContainerImmutabilityPolicy cmdlet creates or updates ImmutabilityPolicy of a Storage blob containers

Examples

Example 1: Create or update ImmutabilityPolicy of a Storage blob container with Storage account name and container name

Set-AzRmStorageContainerImmutabilityPolicy -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount" -ContainerName "myContainer" -ImmutabilityPeriod 10

This command creates or updates ImmutabilityPolicy of a Storage blob container with Storage account name and container name.

Example 2: Extend ImmutabilityPolicy of a Storage blob container, with Storage account object

$accountObject = Get-AzStorageAccount -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount"
$policy = Get-AzRmStorageContainerImmutabilityPolicy -StorageAccount $accountObject -ContainerName "myContainer"
Set-AzRmStorageContainerImmutabilityPolicy -StorageAccount $accountObject -ContainerName "myContainer" -ImmutabilityPeriod 20 -Etag $policy.Etag -ExtendPolicy

This command extend ImmutabilityPolicy of a Storage blob container, with Storage account object. Extend ImmutabilityPolicy can only run after ImmutabilityPolicy is locked.

Example 3: Update ImmutabilityPolicy of a Storage blob container

$containerObject = Get-AzRmStorageContainer -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount" -Name "myContainer"
$policy = Set-AzRmStorageContainerImmutabilityPolicy -Container $containerObject -ImmutabilityPeriod 12
$policy = Set-AzRmStorageContainerImmutabilityPolicy -Container $containerObject -ImmutabilityPeriod 9 -Etag $policy.Etag
$policy = Set-AzRmStorageContainerImmutabilityPolicy -Container $containerObject -AllowProtectedAppendWrite $true
$policy = Set-AzRmStorageContainerImmutabilityPolicy -Container $containerObject -AllowProtectedAppendWrite $false -AllowProtectedAppendWriteAll $true

This command updates ImmutabilityPolicy of a Storage blob container with Storage container object 3 times: First to ImmutabilityPeriod 12 days without etag, then to ImmutabilityPeriod 9 days with etag, then enabled AllowProtectedAppendWrite, finally enabled AllowProtectedAppendWriteAll.

Example 4: Extend ImmutabilityPolicy of a Storage blob container, with ImmutabilityPolicy object

Get-AzRmStorageContainerImmutabilityPolicy -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount" -ContainerName "myContainer" | Set-AzRmStorageContainerImmutabilityPolicy -ImmutabilityPeriod 15 -ExtendPolicy

This command extend ImmutabilityPolicy of a Storage blob container, with ImmutabilityPolicy object. Extend ImmutabilityPolicy can only run after ImmutabilityPolicy is locked.

Parameters

-AllowProtectedAppendWrite

This property can only be changed for unlocked time-based retention policies. With this property enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. '-AllowProtectedAppendWrites' and '-AllowProtectedAppendWritesAll' are mutually exclusive.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AllowProtectedAppendWriteAll

This property can only be changed for unlocked policies. When enabled, new blocks can be written to both 'Appened and Block Blobs' while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. '-AllowProtectedAppendWrites' and '-AllowProtectedAppendWritesAll' are mutually exclusive.

Type:Boolean
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

-Container

Storage container object

Type:PSContainer
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ContainerName

Container Name

Type:String
Aliases:N
Position:Named
Default value:None
Required:True
Accept pipeline input:True
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

-Etag

Immutability policy etag. If -ExtendPolicy is not specified, Etag is optional; else Etag is required.

Type:String
Aliases:IfMatch
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ExtendPolicy

Indicate ExtendPolicy to Extend an existing ImmutabilityPolicy. After ImmutabilityPolicy is locked, it can only be extend.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ImmutabilityPeriod

Immutability period since creation in days.

Type:Int32
Aliases:ImmutabilityPeriodSinceCreationInDays
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Container Name

Type:PSImmutabilityPolicy
Aliases:ImmutabilityPolicy
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

Resource Group Name.

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
Position:1
Default value:None
Required:True
Accept pipeline input:True
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

Inputs

String

PSStorageAccount

PSContainer

PSImmutabilityPolicy

Outputs

PSImmutabilityPolicy