Make sure you have the correct version of PowerShell 5.x installed, by running this command:
$PSVersionTable.PSVersion
If the "Az" and "Az.ResourceGraph" PowerShell modules are not installed, then you can run these PowerShell commands in an elevated shell:
Install-Module -Name "Az" -Repository "PSGallery" -Scope "CurrentUser" -SkipPublisherCheck -Force -Confirm -AllowClobber -Verbose
Install-Module -Name "Az.ResourceGraph" -Repository "PSGallery" -Scope "CurrentUser" -SkipPublisherCheck -Force -Confirm -AllowClobber -Verbose
If PowerShell isn't correctly configured to connect to the PowerShell Gallery (PSGallery) package repository, then you can run these PowerShell commands in an elevated shell:
Find-PackageProvider -Name "Nuget" -Force -Verbose | Install-PackageProvider -Scope "CurrentUser" -Force -Confirm -Verbose
Set-PSRepository -Name "PSGallery" -InstallationPolicy "Trusted" -PackageManagementProvider "Nuget" -Verbose
Set-ExecutionPolicy -Scope "CurrentUser" -ExecutionPolicy "Bypass" -ErrorAction SilentlyContinue -Confirm -Force -Verbose
Install-Module -Name "PowerShellGet" -Repository "PSGallery" -Scope "CurrentUser" -SkipPublisherCheck -Force -Confirm -AllowClobber -Verbose
- Getting started with the PowerShell Gallery
- Find-PackageProvider returns a list of Package Management package providers available for installation.
- Install-PackageProvider Installs one or more Package Management package providers.
- Set-PSRepository sets values for a registered repository.
- Set-ExecutionPolicy sets the PowerShell execution policies for Windows computers.
- Install-Module downloads one or more modules from a repository, and installs them on the local computer.
- "PowerShellGet" is a PowerShell Module with commands for discovering, installing, updating and publishing PowerShell artifacts like Modules, DSC Resources, Role Capabilities, and Scripts.