Update disk-encryption-migrate.md#479
Conversation
Issue: CLI script used while generating new Managed disk with azcopy in MDE to HBE migration document is not working due to Syntax error in SAS token generation step. • Issue observed during disk copy using AzCopy where command failed with “wrong number of arguments” • On initial validation, identified that $sourceSASURI and $targetSASURI variables were empty • Confirmed by echoing variables and seeing no values populated • • Root cause identified as case-sensitivity issue in Azure CLI query • Script was using --query accessSas, while actual field returned by CLI is accessSAS (case-sensitive mismatch) when tried to generate the SAS manually. • • Due to incorrect case, SAS values were not captured into variables, leading to empty inputs for AzCopy • Notably, PowerShell flow worked as expected, as it handles the response object directly without requiring explicit field name matching • However, when using Azure CLI (bash script) to create disk and copy data, SAS generation appeared to fail due to incorrect query casing • Updated query to use --query accessSAS, after which SAS URLs were correctly retrieved • • Post fix, variables were populated successfully and AzCopy command completed without issues
|
@rakesh479 : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
|
Learn Build status updates of commit ba6d11b: ✅ Validation status: passed
For more details, please refer to the build report. |
|
Can you review the proposed changes? IMPORTANT: When the changes are ready for publication, adding a #label:"aq-pr-triaged" |
|
Hello Team, Do we have an update on this. |
|
This pull request has been inactive for at least 14 days. If you are finished with your changes, don't forget to sign off. See the contributor guide for instructions. |
|
@rakesh479 : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
Issue: CLI script used while generating new Managed disk in MDE to HBE migration document is not working due to Syntax error in SAS token generation step.
• Issue observed during disk copy using AzCopy where command failed with “wrong number of arguments”
• On initial validation, identified that $sourceSASURI and $targetSASURI variables were empty
• Confirmed by echoing variables and seeing no values populated
targetSASURI=$(az disk grant-access -n $targetDiskName -g $targetRG --access-level Write --duration-in-seconds 86400 --query [accessSas] -o tsv)
rakesh [ ~ ]$ sourceSASURI=$(az disk grant-access -n $sourceDiskName -g $sourceRG --access-level Read --duration-in-seconds 86400 --query [accessSas] -o tsv)
rakesh [ ~ ]$ echo $sourceSASURI
None
rakesh [ ~ ]$ echo $targetSASURI
None
• Root cause identified as case-sensitivity issue in Azure CLI query
• Script was using --query accessSas, while actual field returned by CLI is accessSAS (case-sensitive mismatch) when tried to generate the SAS manually.
az disk grant-access -n $targetDiskName -g $targetRG --access-level Write --duration-in-seconds 86400
{
"accessSAS": "https://md-impexp-xxxxxxxxx.z5.blob.storage.azure.net/qfc0cr0jtq2s/abcd?sv=xxxx-03-28&sr=b&si=a76a778d-42b6-4225-ae51-cee4054a5442&sig=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%3D"
}
• Due to incorrect case, SAS values were not captured into variables, leading to empty inputs for AzCopy
• Notably, PowerShell flow worked as expected, as it handles the response object directly without requiring explicit field name matching
• However, when using Azure CLI (bash script) to create disk and copy data, SAS generation appeared to fail due to incorrect query casing
• Updated query to use --query accessSAS, after which SAS URLs were correctly retrieved
targetSASURI=$(az disk grant-access -n $targetDiskName -g $targetRG --access-level Write --duration-in-seconds 86400 --query [accessSAS] -o tsv)
rakesh [ ~ ]$ sourceSASURI=$(az disk grant-access -n $sourceDiskName -g $sourceRG --access-level Read --duration-in-seconds 86400 --query [accessSAS] -o tsv)
rakesh [ ~ ]$ echo $targetSASURI
https://md-impexp-xxxxxxxxxxxxxxxxxxxxxxjvk.z5.blob.storage.azure.net/qfc0cr0jtq2s/abcd?sv=2018-03-28&sr=b&si=a76a778d-42b6-4225-ae51-cee4054a5442xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0%3D
rakesh [ ~ ]$ echo $sourceSASURI
https://md-hdd-xxxxxxxxxxxxxxx.blob.storage.azure.net/qcs35zbrcl3t/abcd?sv=2018-03-28&sr=b&si=2a8fdd6f-b9ec-48e9-9947-031d07e62xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc%3D
• Post fix, variables were populated successfully and AzCopy command completed without issues