AZ-305 Design business continuity solutions Practice Question
Exhibit
Refer to the exhibit. $rg = Get-AzResourceGroup -Name "DR-RG" $vault = Get-AzRecoveryServicesVault -ResourceGroupName $rg.ResourceGroupName -Name "ContosoVault" Set-AzRecoveryServicesAsrVaultContext -Vault $vault $fabric = Get-AzRecoveryServicesAsrFabric -Name "ContosoFabric" $protectionContainer = Get-AzRecoveryServicesAsrProtectionContainer -Fabric $fabric $policy = Get-AzRecoveryServicesAsrPolicy -Name "ContosoReplicationPolicy" $vm = Get-AzVM -ResourceGroupName "PROD-RG" -Name "WebVM01" New-AzRecoveryServicesAsrReplicationProtectedItem -VM $vm -ProtectionContainer $protectionContainer -Policy $policy
Refer to the exhibit. An administrator runs the PowerShell script to enable replication for a VM. The script fails with an error that the VM is not found. What is the most likely cause?
⚠ Common exam trap
Test-takers frequently assume the error is due to a missing vault or policy, but the 'VM not found' error specifically points to a subscription context mismatch, not a resource existence issue.
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
✓
The Azure PowerShell context is not set to the subscription that contains the VM.
The PowerShell script uses `Get-AzRecoveryServicesBackupItem` and `Enable-AzRecoveryServicesBackupProtection` to enable replication for a VM. If the Azure PowerShell context (set via `Set-AzContext` or `Connect-AzAccount`) is not targeting the subscription containing the VM, the cmdlets will not find the VM resource, resulting in a 'VM not found' error. This is the most likely cause because the script otherwise references a valid vault, container, and policy.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The Recovery Services vault does not exist.
Why it's wrong here
The script's first operation, Get-AzRecoveryServicesVault, successfully returns a vault object; therefore, the vault clearly exists in the current Azure environment. If the vault were missing, this cmdlet would return nothing or terminate with a 'ResourceNotFound' error, halting the script before any backup or replication commands run. Since the script continues to retrieve containers and policies, the nonexistence of the vault cannot be the source of the failure.
- ✗
The protection container is not available.
Why it's wrong here
Get-AzRecoveryServicesBackupContainer yields a valid protection container, such as an AzureVM container, which means the container is registered and enabled within the vault. An unavailable container would produce an empty result or an exception, and New-AzRecoveryServicesBackupProtection would fail immediately at that stage with a container-specific error. Because the container is successfully retrieved and all subsequent commands execute, this option is not a plausible cause.
- ✗
The replication policy is not valid.
Why it's wrong here
The cmdlet Get-AzRecoveryServicesBackupPolicy retrieves a specific policy object successfully, confirming that the policy exists and is well-formed. An invalid policy would either be absent from the results or trigger a validation error when applied by New-AzRecoveryServicesBackupProtection, but no such policy-related failure is indicated here. The error arises after these resources are fetched, so the policy's validity is not the problem.
- ✓
The Azure PowerShell context is not set to the subscription that contains the VM.
Why this is correct
The script uses Get-AzVM to locate the virtual machine, and this cmdlet depends on the active Azure context — the subscription set by Set-AzContext or Select-AzSubscription. If the context points to a different subscription than the one holding the target VM, Get-AzVM returns no matching VM, causing the backup protection command to fail with 'VM not found' even though the vault, container, and policy are all visible in the current context. The solution is to explicitly set the context (e.g., Set-AzContext -SubscriptionId '...') before running the script.
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.