Courseiva

AZ-204 Practice Question: Connect to and consume Azure services and third-party services

Exhibit

Refer to the exhibit.

az storage blob upload \
  --account-name mystorageaccount \
  --container-name mycontainer \
  --name myblob \
  --file /path/to/file \
  --auth-mode key

Refer to the exhibit. You run the above Azure CLI command to upload a blob to Azure Blob Storage. The command fails with the error 'This request is not authorized to perform this operation.' You have verified that the storage account name and container name are correct, and the file exists. What should you do to resolve the error?

⚠ Common exam trap

Many candidates assume the error is about network or permissions on the container, but the real issue is that the CLI command lacks any form of authentication credential (key or token), and they may incorrectly think changing to --auth-mode login will fix it without ensuring Azure AD authentication is properly set up.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Provide the storage account key using the --account-key parameter or set the AZURE_STORAGE_KEY environment variable.

The error 'This request is not authorized to perform this operation' indicates that the Azure CLI command did not provide valid credentials for the storage account. By default, Azure CLI uses Azure AD authentication (--auth-mode login), but when the command is run without a logged-in user context or without proper RBAC roles, it fails. Providing the storage account key via --account-key or setting the AZURE_STORAGE_KEY environment variable supplies the shared key for HMAC-SHA256 authorization, which is a fallback authentication method that does not require Azure AD.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Provide the storage account key using the --account-key parameter or set the AZURE_STORAGE_KEY environment variable.

    Why this is correct

    When `--auth-mode key` is specified, the Azure CLI command requires the storage account's access key to authenticate operations. The error indicates this essential credential is not being supplied. Providing the key directly via the `--account-key` parameter or by setting the `AZURE_STORAGE_KEY` environment variable allows the command to successfully authenticate and execute the intended operation using the chosen key-based method.

  • Generate a shared access signature (SAS) and use it instead of key.

    Why it's wrong here

    Generating a Shared Access Signature (SAS) would provide an alternative authentication method for accessing storage resources, offering granular permissions and time-limited access. However, the current command explicitly uses `--auth-mode key`, indicating an intent to authenticate with the storage account's full access key. Switching to SAS would be a different authentication strategy, not a resolution for the immediate problem of the missing key required by the chosen key-based authentication mode.

  • Change --auth-mode key to --auth-mode login.

    Why it's wrong here

    Changing `--auth-mode key` to `--auth-mode login` would switch the authentication mechanism from using a storage account access key to leveraging the Azure Active Directory (Azure AD) identity of the currently logged-in user or service principal. While Azure AD authentication is a valid and often preferred method, it requires the Azure AD identity to have appropriate Role-Based Access Control (RBAC) permissions on the storage account. This change does not address the original issue of the missing storage account key when `key` authentication was explicitly selected, and it might introduce new permission-related errors if RBAC is not configured.

  • Upgrade to the latest version of Azure CLI.

    Why it's wrong here

    Upgrading the Azure CLI typically resolves software bugs, introduces new features, or updates command syntax. A missing authentication credential, such as a storage account key, is a configuration or input issue, not a defect in the CLI itself that an upgrade would rectify. The CLI is functioning as designed by reporting the absence of the required key when `key` authentication mode is selected without the key being provided.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

Quick reference

Azure Blob Storage Tier Comparison

TierStorage CostRetrieval CostLatencyUse Case
HotHighestLowestImmediateActive data, frequent reads
CoolLowerHigherImmediateData accessed < once / month
ColdLower stillHigherImmediateData accessed < once / quarter
ArchiveLowestHighest + rehydration delayHoursLong-term compliance retention

About these practice questions

This AZ-204 question is part of Courseiva's 881-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.