You are configuring a script on an Azure virtual machine (VM) to automate the daily upload of log files to a blob container in an Azure storage account named stlogs. The VM is configured with a system-assigned managed identity that has been granted the Storage Blob Data Contributor role on the storage account. The script must run without any interactive prompts. Which command must be executed in the script to authenticate AzCopy before running the copy command?
- azcopy login --identityAnswer
- Bazcopy login
- Cazcopy login --service-principal --tenant-id <tenant-id> --username <username>
- DAppend a Shared Access Signature (SAS) token to the destination URL that is configured with a one-year expiration window.
Answer
The command 'azcopy login --identity' must be executed.
The command 'azcopy login --identity' instructs AzCopy to authenticate using the virtual machine's system-assigned managed identity. This enables secure, non-interactive authentication suitable for automated scripts without exposing or managing credentials.
Step-by-Step Solution
Key Concept
AzCopy authentication using managed identities for automated, non-interactive workflows.