The error message "Operation returned an invalid status code 'BadRequest'" indicates that there was an issue with the request sent to the Azure Storage service. In this case, it seems that the request made by the Set-AzStorageObjectReplicationPolicy
cmdlet was not valid, resulting in a "BadRequest" response from the Azure service.
To troubleshoot this issue, you can try the following steps:
- Verify Parameters: Double-check the parameters passed to the
Set-AzStorageObjectReplicationPolicy
cmdlet. Ensure that all required parameters are provided and correctly formatted, including resource group name, storage account names, policy ID, and replication rules. - Check Account Permissions: Ensure that the account used to execute the PowerShell command has sufficient permissions to perform the operation. The account should have the necessary permissions to manage storage accounts and configure object replication policies.
- Review Rule Configuration: Review the configuration of the replication rules (
$rule1
and$rule2
) to ensure they are correctly defined and comply with Azure Storage replication requirements.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin