AZ-305 Design data storage solutions Practice Question
Exhibit
Refer to the exhibit. $connectionString = "DefaultEndpointsProtocol=https;AccountName=mystorage;AccountKey=mykey;EndpointSuffix=core.windows.net" $containerName = "mycontainer" $blobName = "myblob.txt" $content = "Hello, World!" $ctx = New-AzStorageContext -ConnectionString $connectionString Set-AzStorageBlobContent -Context $ctx -Container $containerName -Blob $blobName -Value $content -StandardBlobTier Hot
You run the above PowerShell script to upload a blob to Azure Storage. The script fails with an error: 'The specified container does not exist.' What should you do first to resolve the issue?
⚠ Common exam trap
It's easy for candidates to confuse authentication/authorization issues (SAS tokens, key access) with the fundamental prerequisite of container existence, leading them to select options that address permissions rather than the missing resource.
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
✓
Create the container using New-AzStorageContainer.
The error 'The specified container does not exist' indicates that the target container has not been created in the Azure Storage account. The PowerShell script uses the `Set-AzStorageBlobContent` cmdlet, which requires an existing container as the destination. Therefore, the first corrective action is to create the container using `New-AzStorageContainer` before uploading the blob.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Create the container using New-AzStorageContainer.
Why this is correct
The script fails because the target container is not present in the storage account. Azure Blob Storage enforces a strict hierarchy: every blob must reside inside an existing container. The Set-AzStorageBlobContent cmdlet (or equivalent upload command) returns a 404 ContainerNotFound error when the container is missing. Running New-AzStorageContainer with the same storage context and container name creates the required namespace, allowing the upload to succeed.
- ✗
Use a different connection string with a SAS token.
Why it's wrong here
Substituting a SAS token for the account key does not address the root cause, which is the absence of the container. A SAS token merely grants delegated access to specific resources; it cannot create the container unless the token includes 'Create' permissions for containers, but the script itself still does not call New-AzStorageContainer. Even with a valid SAS, an upload to a non-existent container will still fail with a 404 ContainerNotFound error because authentication is never the issue here.
- ✗
Grant the storage account key access to the user.
Why it's wrong here
The storage account key is already embedded in the connection string, so the script has complete account-level authorization to perform any operation, including container creation and blob upload. Granting the user access to the account key is a security concern (it exposes full control) and does not change the fact that the container must be created before a blob can be uploaded. Therefore, this option neither fixes the immediate failure nor is a recommended practice for production.
- ✗
Change the -StandardBlobTier parameter to Cool.
Why it's wrong here
The -StandardBlobTier parameter only sets the access tier (Hot, Cool, or Archive) of the blob being uploaded, which affects storage cost and performance after the blob exists. Since the upload fails before any blob is written, the tier selection is never processed; the missing container is the sole reason for the error. Changing the tier to Cool would not create the container, so the script would continue to fail with the same 404 ContainerNotFound exception.
Visual reference
Go deeper
Related to this question
About these practice questions
One of 212 original AZ-305 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-305 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-305 exam.