Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Set-AzStorageObjectReplicationPolicy
- Module:
- Az.Storage Module
Creates or updates the specified object replication policy in a Storage account.
Syntax
AccountName (Default)
Set-AzStorageObjectReplicationPolicy
[-ResourceGroupName] <String>
[-StorageAccountName] <String>
-SourceAccount <String>
-Rule <PSObjectReplicationPolicyRule[]>
[-PolicyId <String>]
[-DestinationAccount <String>]
[-EnableMetric <Boolean>]
[-EnablePriorityReplication <Boolean>]
[-EnableTagsReplication <Boolean>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PolicyObject
Set-AzStorageObjectReplicationPolicy
[-ResourceGroupName] <String>
[-StorageAccountName] <String>
-InputObject <PSObjectReplicationPolicy>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
AccountObject
Set-AzStorageObjectReplicationPolicy
-StorageAccount <PSStorageAccount>
-SourceAccount <String>
-Rule <PSObjectReplicationPolicyRule[]>
[-PolicyId <String>]
[-DestinationAccount <String>]
[-EnableMetric <Boolean>]
[-EnablePriorityReplication <Boolean>]
[-EnableTagsReplication <Boolean>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-AzStorageObjectReplicationPolicy cmdlet creates or updates the specified object replication policy in a Storage account.
Examples
Example 1: Set object replication policy to both destination and source account.
$rule1 = New-AzStorageObjectReplicationPolicyRule -SourceContainer src1 -DestinationContainer dest1
$rule2 = New-AzStorageObjectReplicationPolicyRule -SourceContainer src -DestinationContainer dest -MinCreationTime 2019-01-01T16:00:00Z -PrefixMatch a,abc,dd
$srcAccount = Get-AzStorageAccount -ResourceGroupName "myresourcegroup" -AccountName "mysourceaccount"
Set-AzStorageObjectReplicationPolicy -ResourceGroupName "myresourcegroup" -AccountName "mydestaccount" -PolicyId default -SourceAccount $srcAccount.Id -Rule $rule1,$rule2 -EnableMetric $true -EnablePriorityReplication $true -EnableTagsReplication $true
ResourceGroupName StorageAccountName PolicyId EnabledTime SourceAccount DestinationAccount Metrics PriorityReplication TagsReplication Rules
----------------- ------------------ -------- ----------- ------------- ------------------ ------- ------------------- --------------- -----
myresourcegroup mydestaccount 56bfa11c-81ef-4f8d-b307-5e5386e16fba mysourceaccount mydestaccount Enabled Enabled Enabled [5fa8b1d6-4985-4abd-a0b3-ec4d07295a43,...]
$destPolicy = Get-AzStorageObjectReplicationPolicy -ResourceGroupName "myresourcegroup" -AccountName "mydestaccount"
Set-AzStorageObjectReplicationPolicy -ResourceGroupName "myresourcegroup" -AccountName "mysourceaccount" -InputObject $destPolicy
ResourceGroupName StorageAccountName PolicyId EnabledTime SourceAccount DestinationAccount Metrics PriorityReplication TagsReplication Rules
----------------- ------------------ -------- ----------- ------------- ------------------ ------- ------------------- --------------- -----
myresourcegroup mysourceaccount 56bfa11c-81ef-4f8d-b307-5e5386e16fba mysourceaccount mydestaccount Enabled Enabled Enabled [5fa8b1d6-4985-4abd-a0b3-ec4d07295a43,...]
This command sets object replication policy to both destination and source account. First create 2 object replication policy rules, and set policy to destination account with the 2 rules and source account resource Id, and enable metrics, enable priority replication. Then get the object replication policy from destination account and set to source account. Please note, when storage account has AllowCrossTenantReplication as false, SourceAccount and DestinationAccount should be account resource Id.
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
-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
-DestinationAccount
Object Replication Policy DestinationAccount, if SourceAccount is account name it should be account name, else should be account resource id. Default value will be the input StorageAccountName, or the resourceID of the account.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-EnableMetric
Indicates whether object replication metrics feature is enabled for the policy.
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-EnablePriorityReplication
Indicates whether object replication priority replication feature is enabled for the policy. This feature provides enhanced replication performance and reduces recovery time objectives (RTO) for critical data replication scenarios.
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-EnableTagsReplication
Indicates whether object replication tags replication feature is enabled for the policy.
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-InputObject
Object Replication Policy Object to Set to the specified Account.
Parameter properties
| Type: | PSObjectReplicationPolicy |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PolicyId
Object Replication Policy Id. It should be a GUID or 'default'. If not input the PolicyId, will use 'default', which means to create a new policy and the Id of the new policy will be returned in the created policy.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
Resource Group Name.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Rule
Object Replication Policy Rules.
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SourceAccount
Object Replication Policy SourceAccount. It should be resource id if allowCrossTenantReplication is false..
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-StorageAccount
Storage account object
Parameter properties
| Type: | PSStorageAccount |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-StorageAccountName
Storage Account Name.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AccountName |
Parameter sets
-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
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
PSObjectReplicationPolicy
Outputs
PSObjectReplicationPolicy
Azure PowerShell
Feedback
Was this page helpful?
