I am writing a script to set up object replication between my Aaure storage containers. I have over 50 containers in a storage account. First I created a replication policy with below command,
first_container=$(head -1 container_list.txt)
az storage account or-policy create \
--account-name $DESTINATION_STORAGE_ACCOUNT \
--resource-group $DESTINATION_RESOURCE_GROUP \
--source-account $SOURCE_STORAGE_ACCOUNT \
--destination-account $DESTINATION_STORAGE_ACCOUNT \
--source-container $first_container \
--destination-container $first_container \
--min-creation-time '2010-09-01T00:00:00Z'
then have a logic to add rules to the policy
policy_id=$(az storage account or-policy list --account-name $DESTINATION_STORAGE_ACCOUNT --query "[].policyId" -o tsv)
for container in $(sed -n '1!p' list.txt); do
az storage account or-policy rule add \
--account-name $DESTINATION_STORAGE_ACCOUNT \
--resource-group $SOURCE_RESOURCE_GROUP \
--source-container $container \
--destination-container $container \
--policy-id $policy_id
done
But only 10 rules are allowed in a policy, once the loop reaches to 11th container, az command will fail with the error (MaxLimitReachedForRequestParameters) Max limit has been reached for request parameters: Policy.Rules.
my question is, how can I create a second replication policy through az cli ? If i execute az storage account or-policy create
command again, instead of creating new policy, it just updates the existing policy