Install Azure CLI on PowerShell

To install Azure CLI on PowerShell, perform the following steps:

  1. In your PowerShell command prompt, execute the following command to download Azure CLI executable file:

    PS C:\Users\TestUser> $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://azcliprod.blob.core.windows.net/msi/azure-cli-2.51.0.msi -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; Remove-Item .\AzureCLI.msi
  2. Install Az PowerShell module.

    PS C:\Users\TestUser> Install-Module Az

    The latest version of the Az PowerShell module from the PowerShell repository is downloaded and installed.

  3. Log in using your Azure account to start a CLI session.

    PS C:\Users\TestUser> az login
  4. Authorize your session.

    Once the authorization is complete, you can access the Azure Portal. The session details appear in the PowerShell prompt.

    A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.
    [
      {
        "cloudName": "AzureCloud",
        "homeTenantId": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx",
        "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "isDefault": true,
        "managedByTenants": [],
        "name": "Eng Azure",
        "state": "Enabled",
        "tenantId": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx",
        "user": {
          "name": "[email protected]",
          "type": "user"
        }
      }
    ]
    PS C:\Users\TestUser>
  5. Navigate to the downloaded ARM template folder and set the execution policy for this folder.

    PS C:\Users\TestUser\Templates> Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

For more information, see here.

COMPANY INFORMATION: Copyright © 2023 A10 Networks, Inc. All Rights Reserved. Legal Notice