Hi,
One option is enable System Managed Identity on the VM, and assign this Identity Storage Blob Data Contributor on your storage account. In the VM, you need to add environment variable AZCOPY_AUTO_LOGIN_TYPE=MSI so that azcopy will know to use System Managed Identity.
Once everything is set up you won't need to deal with SAS anymore.
Basic steps are:
- Navigate to your VM in portal, click on Idenity blade, enable System Managed Identity and save
- Navigate to your storage account, click on Access control (IAM) blade, Add role assignment for for VM's managed identity for Storage Blob Data Contributor
- Inside of the VM, add
AZCOPY_AUTO_LOGIN_TYPE
environment variable, and set it to MSI. For Windows you can do this via Advanced System Settings -- Environment Variables button.
Authorize by using a system-wide managed identity
Please click Accept Answer and upvote if the above was helpful. If something is unclear or you need help with a specific step, add a comment below.
Thanks.
-TP