Courseiva

AZ-305 Design infrastructure solutions Practice Question

Exhibit

Refer to the exhibit.

```
$rg = 'myResourceGroup'
$location = 'eastus'
$vnetName = 'myVNet'
$subnetName = 'mySubnet'
$publicIPName = 'myPublicIP'
$nsgName = 'myNSG'
$nicName = 'myNIC'
$vmName = 'myVM'
$vmSize = 'Standard_DS2_v2'
$adminUsername = 'azureuser'
$adminPassword = 'P@ssw0rd123!'

New-AzResourceGroup -Name $rg -Location $location
$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix '10.0.1.0/24'
$vnet = New-AzVirtualNetwork -ResourceGroupName $rg -Location $location -Name $vnetName -AddressPrefix '10.0.0.0/16' -Subnet $subnet
$publicIP = New-AzPublicIpAddress -ResourceGroupName $rg -Location $location -AllocationMethod Static -Name $publicIPName
$nsgRule = New-AzNetworkSecurityRuleConfig -Name 'RDP' -Protocol Tcp -Direction Inbound -Priority 1000 -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 3389 -Access Allow
$nsg = New-AzNetworkSecurityGroup -ResourceGroupName $rg -Location $location -Name $nsgName -SecurityRules $nsgRule
$nic = New-AzNetworkInterface -ResourceGroupName $rg -Location $location -Name $nicName -SubnetId $subnet.Id -PublicIpAddressId $publicIP.Id -NetworkSecurityGroupId $nsg.Id
$vmConfig = New-AzVMConfig -VMName $vmName -VMSize $vmSize
Set-AzVMOperatingSystem -VM $vmConfig -Windows -ComputerName $vmName -Credential (New-Object System.Management.Automation.PSCredential ($adminUsername, (ConvertTo-SecureString $adminPassword -AsPlainText -Force)))
New-AzVM -ResourceGroupName $rg -Location $location -VM $vmConfig
```

You execute the above PowerShell script to create a Windows VM in Azure. After the script completes, you try to RDP to the public IP address but the connection fails. What is the most likely reason?

⚠ Common exam trap

Many candidates assume the script's `New-AzVM` command automatically attaches the NIC created earlier, but Azure requires an explicit NIC attachment parameter, and the script omits it, leaving the NIC orphaned.

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 network interface is not attached to the VM.

The PowerShell script creates a VM but does not explicitly associate the network interface (NIC) with the VM. In Azure, a NIC must be attached to a VM for network connectivity; without this association, the VM has no network path, and RDP (TCP/3389) cannot reach the VM even if a public IP and NSG rules are correctly configured.

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 network interface is not attached to the VM.

    Why this is correct

    A virtual machine fundamentally requires an attached network interface to establish any network connectivity, including responding to inbound RDP requests. If the PowerShell script successfully created both the VM and the network interface but omitted the crucial step to attach the interface to the VM, the VM would lack the necessary component to communicate. Consequently, RDP connections to the public IP address would fail because the VM cannot receive or process the connection attempt.

  • ✗

    The public IP address is not assigned correctly.

    Why it's wrong here

    The script explicitly creates a static public IP and binds it to the NIC's IP configuration, so the public IP resource is assigned correctly. In Azure, a public IP must be associated with a NIC's IP configuration for a VM to use it; this association is present. The inability to RDP is because the NIC itself is not attached to the VM, not because the IP is misconfigured.

  • ✗

    The NSG rule blocks RDP traffic.

    Why it's wrong here

    The NSG contains an inbound allow rule for RDP on TCP port 3389, so it is not blocking the traffic. Even when an NSG is present, it only filters traffic bound to a NIC or subnet; it cannot establish connectivity for a NIC that is not attached to the VM. Since the NIC is detached, the VM has no data-plane network path for the NSG to evaluate, making an NSG block an incorrect explanation.

  • ✗

    The VM size does not support RDP.

    Why it's wrong here

    The VM size determines compute, memory, disk throughput, and other performance limits, but it has no bearing on whether RDP is available. Windows images come with Remote Desktop enabled by default, and any Azure VM size that supports Windows can accept RDP sessions once the OS boots and networking is attached. Therefore, the selected VM size cannot be the reason RDP connections fail.

About these practice questions

Courseiva writes every AZ-305 question from scratch — 795 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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-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.