- Make sure you have access to https://dev.azure.com/AzDeploymentWhatIf/WhatIfModules
- Create a PAT (Personal Access Token) to get command-line access to Azure DevOps Services
- Open PowerShell as administrator
- Run the following commands:
$password = ConvertTo-SecureString "YOUR PAT FROM THE CREATING THE PREVIOUS STEP" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential "YOUR EMAIL FOR AZURE DEVOPS SERVICES", $password
Register-PSRepository -Name WhatIfRepository -SourceLocation https://pkgs.dev.azure.com/AzDeploymentWhatIf/WhatIfModules/_packaging/WhatIfFeed/nuget/v2 -PackageManagementProvider Nuget -InstallationPolicy Trusted -Credential $credential
Install-Module -Name Az.Resources -Repository WhatIfRepository -RequiredVersion 2.0.1-alpha5 -AllowPrerelease -AllowClobber -Credential $credential -SkipPublisherCheck
- If you want to switch back to another installed version, simply run:
Import-Module Az.Resources -RequiredVersion <version_number>
- To check if there's a newer version, do:
Find-Module -Name Az.Resources -Repository WhatIfRepository -AllVersions -AllowPrerelease -Credential $credential
- If you are done testing the package, you may uninstall it by running:
Uninstall-Module -Name Az.Resources -RequiredVersion 2.0.1-alpha5 -AllowPrerelease
If you are using the default version of the PowerShellGet
module, you may encounter Unable to resolve package resource
error when running the commands above. You can fix it by updating PowerShellGet
to the newest version:
Uninstall-Module PowershellGet
Install-Module PowerShellGet -Force
Once the update is done, restart your PowerShell session and you should be able to install the What-If module.