Share via

Unable to create Virtual Machine resources using Azure PowerShell

SVM 0 Reputation points
2026-05-18T21:27:32.3+00:00

In my Azure trial, I am unable to successfully create Virtual Machines using PowerShell (Task 3)

Reference: https://microsoftlearning.github.io/AZ-700-Designing-and-Implementing-Microsoft-Azure-Networking-Solutions/Instructions/Exercises/M01-Unit%206%20Configure%20DNS%20settings%20in%20Azure.html

Files from GitHUB uplaoad successfully and confirmed they were present. Error states. path is not found.

Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.


1 answer

Sort by: Most helpful
  1. Q&A Assist
    2026-05-18T21:28:00.9366667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error that the path is not found when creating VMs with Azure PowerShell in a trial subscription is typically caused by one of these issues:

    1. The script is being run from a directory where the referenced files (template, parameters, or scripts) do not exist.
    2. The VM creation command is not using the built-in New-AzVM flow that auto-creates resources, but instead expects existing files or configuration objects that were not created.

    To validate and correct the setup using Azure PowerShell:

    1. Ensure the Azure PowerShell module is available and connected:
      • Run Get-Module -ListAvailable Az to confirm the Az module is installed.
      • Run Connect-AzAccount if using local PowerShell.
    2. Confirm the working directory contains the files uploaded from GitHub:
      • In the Azure Cloud Shell or local PowerShell, run Get-ChildItem in the directory where the script is executed.
      • Verify that any referenced template or script files are present in that directory.
    3. If the lab allows using New-AzVM directly, create the VM and its resources in one step, which avoids path issues:
      • First create a resource group:
             New-AzResourceGroup -Name 'myResourceGroup' -Location 'centralus'
        
      • Then create a VM (Windows example):
             New-AzVM -ResourceGroupName 'myResourceGroup' -Location 'centralus'
        
        This command creates the VM and dependent resources (VNet, NIC, etc.) automatically if they do not exist.
    4. If the lab uses an advanced configuration, ensure the VM configuration object and NIC are created before calling New-AzVM:
      • Create the VM configuration and OS settings with New-AzVMConfig and Set-AzVMOperatingSystem.
      • Attach a NIC created with New-AzNetworkInterface using Add-AzVMNetworkInterface.
      • Finally create the VM:
             New-AzVM -ResourceGroupName $myResourceGroup -Location $location -VM $vm
        
    5. If the lab uses a Resource Manager template, ensure the template path is correct:
      • If using a local template, confirm the -TemplateFile path points to a file that exists in the current directory.
      • If using a template from a URL, ensure the script references that URL rather than a local path.
    6. Because this is a trial subscription, also verify that the region and VM size used in the script are available and supported:
      • Create the resource group and VM in a supported region (for example, EastUS or centralus) as shown in the quickstart examples.

    If the script still fails with “path not found,” adjust the script to either:

    • Run from the directory where the uploaded files reside, or
    • Use direct New-AzVM calls as shown above so that no external file paths are required.

    References:

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.