A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/azure-stack/operator/powershell-install-az-module below:

Install PowerShell Az module for Azure Stack Hub - Azure Stack Hub

Important

All versions of the Azure Resource Manager (AzureRM) PowerShell module are outdated and out of support. The Az PowerShell module is now the recommended PowerShell module for interacting with Azure and Azure Stack Hub. This article describes how to get started with the Az PowerShell module. For information about how to migrate to the Az PowerShell module, see Migrate from AzureRM to Azure PowerShell Az in Azure Stack Hub. For details about the increased functionality of the Az modules, which have been adopted across global Azure, see Introducing the Azure Az PowerShell module.

Azure Stack Hub Version AzureStack PowerShell version 2102 2.1.1 2108 2.2.0 2206 2.3.0 2301+ 2.4.0

For more information about AzureStack modules, see the PSGallery.

This article explains how to install the Azure PowerShell Az and compatible Azure Stack Hub administrator modules using PowerShellGet. You can install the Az modules on Windows, macOS, and Linux platforms.

You can also run the Az modules for Azure Stack Hub in a Docker container. For instructions, see Use Docker to run PowerShell for Azure Stack Hub.

You can use API profiles to specify the compatible endpoints for the Azure Stack Hub resource providers. API profiles provide a way to manage version differences between Azure and Azure Stack Hub. An API version profile is a set of Azure Resource Manager PowerShell modules with specific API versions. Each cloud platform has a set of supported API version profiles. For example, Azure Stack Hub supports a specific profile version such as 2020-09-01-hybrid. When you install a profile, the Azure Resource Manager PowerShell modules that correspond to the specified profile are installed.

You can install Azure Stack Hub compatible PowerShell Az modules in Internet-connected, partially connected, or disconnected scenarios. This article walks you through the detailed instructions for these scenarios.

Verify your prerequisites

Az modules are supported on Azure Stack Hub with update 2002 or later, and with all current hotfixes installed. See the Azure Stack Hub release notes for more information.

The Azure PowerShell Az modules work with PowerShell 5.1 or higher on Windows, or PowerShell Core 6.x and later on all platforms. You should install the latest version of PowerShell Core available for your operating system. Azure PowerShell has no other requirements when run on PowerShell Core.

To check your PowerShell version, run the following command:

$PSVersionTable.PSVersion
Prerequisites for Windows

To use Azure PowerShell in PowerShell 5.1 on Windows:

  1. Update to Windows PowerShell 5.1 if needed. If you're on Windows 10, you already have PowerShell 5.1 installed.

  2. Install .NET Framework 4.7.2 or later.

  3. Make sure you have the latest version of PowerShellGet. Run the following cmdlets from an elevated prompt:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    
    powershell -noprofile
    $PSVersionTable
    Uninstall-Module PowershellGet -AllVersions -Force -Confirm:$false
    Get-module PowershellGet
    Find-module PowershellGet
    Install-Module PowershellGet -MinimumVersion 2.2.3 -Force
    
Prerequisites for Linux and Mac

PowerShell Core 6.x or later version is needed. Follow the link for instructions.

Uninstall existing versions of the Azure Stack Hub PowerShell modules

Before you install the required version, make sure that you uninstall any previously installed Azure Stack Hub Azure Resource Manager or Az PowerShell modules. Uninstall the modules using one of the following two methods:

Connected: install with internet connectivity

The Azure Stack Az module works with PowerShell 5.1 or greater on a Windows machine, or PowerShell 6.x or greater on a Linux or macOS platform. Using the PowerShellGet cmdlets is the preferred installation method. This method works the same way on the supported platforms.

  1. Run the following command from a PowerShell session to update PowerShellGet to a minimum of version 2.2.3:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    Install-Module PowerShellGet -MinimumVersion 2.2.3 -Force
    
  2. Close your PowerShell session, then open a new PowerShell session so that the update can take effect.

  3. Run the following commands to install Az modules:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    Install-Module -Name Az.BootStrapper -Force
    Install-AzProfile -Profile 2020-09-01-hybrid -Force
    
  4. Install the AzureStack PowerShell modules:

    Install-Module -Name AzureStack -RequiredVersion 2.4.0
    
    Install-Module -Name AzureStack -RequiredVersion 2.3.0
    
    Install-Module -Name AzureStack -RequiredVersion 2.2.0
    
    Install-Module -Name AzureStack -RequiredVersion 2.1.1
    
Disconnected: Install without internet connection

In a disconnected scenario, you first download the PowerShell modules to a machine that has internet connectivity. Then, you transfer them to the Azure Stack Development Kit (ASDK) for installation.

Sign in to a computer with internet connectivity and use the following scripts to download the Azure Resource Manager and Azure Stack Hub packages, depending on your version of Azure Stack Hub.

Installation has five steps:

  1. Install Azure Stack Hub PowerShell on a connected machine.
  2. Enable additional storage features.
  3. Transport the PowerShell packages to your disconnected workstation.
  4. Manually bootstrap the NuGet provider on your disconnected workstation.
  5. Confirm the installation of PowerShell.
Install Azure Stack Hub PowerShell
  1. The following code installs Az modules from the trustworthy online repository:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    Install-module -Name PowerShellGet -MinimumVersion 2.2.3 -Force
    Import-Module -Name PackageManagement -ErrorAction Stop
    $savedModulesPath = "<Path that is used to save the packages>"
    Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name Az -Path $savedModulesPath -Force -RequiredVersion 2.0.1
    
  2. After the Az modules are installed, proceed with installing the AzureStack modules:

    Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name AzureStack -Path $savedModulesPath -Force -RequiredVersion 2.4.0
    
    Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name AzureStack -Path $savedModulesPath -Force -RequiredVersion 2.3.0
    
    Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name AzureStack -Path $savedModulesPath -Force -RequiredVersion 2.2.0
    
    Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name AzureStack -Path $savedModulesPath -Force -RequiredVersion 2.1.1
    

Note

On machines without an internet connection, we recommend that you run the Disable-AzDataCollection cmdlet to disable the telemetry data collection. Otherwise, you might experience a performance degradation of the cmdlets. This is applicable only for machines without an internet connection.

Add your packages to your workstation
  1. Copy the downloaded packages to a USB device.

  2. Sign in to the disconnected workstation and copy the packages from the USB device to a location on the workstation.

  3. Manually bootstrap the NuGet provider on your disconnected workstation. For instructions, see Manually bootstrapping the NuGet provider on a machine that isn't connected to the internet.

  4. Register this location as the default repository and install the AzureRM and AzureStack modules from this repository:

     # requires -Version 5
     # requires -RunAsAdministrator
     # requires -Module PowerShellGet
     # requires -Module PackageManagement
    
     $SourceLocation = "<Location on the development kit that contains the PowerShell packages>"
     $RepoName = "MyNuGetSource"
     [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
     Register-PSRepository -Name $RepoName -SourceLocation $SourceLocation -InstallationPolicy Trusted
    
  5. Install the Az modules.

     Install-Module -Name Az -Repository $RepoName -RequiredVersion 2.0.1 -Scope AllUsers
    
  6. Install the AzureStack modulesL

    Install-Module -Name AzureStack -Repository $RepoName -RequiredVersion 2.4.0 -Scope AllUsers
    
    Install-Module -Name AzureStack -Repository $RepoName -RequiredVersion 2.3.0 -Scope AllUsers
    
    Install-Module -Name AzureStack -Repository $RepoName -RequiredVersion 2.2.0 -Scope AllUsers
    
    Install-Module -Name AzureStack -Repository $RepoName -RequiredVersion 2.1.1 -Scope AllUsers
    
Confirm the installation of PowerShell

Confirm the installation by running the following command:

Get-Module -Name "Az*" -ListAvailable
Get-Module -Name "Azs*" -ListAvailable
Configure PowerShell to use a proxy server

In scenarios that require a proxy server to access the internet, you first configure PowerShell to use an existing proxy server:

  1. Open an elevated PowerShell prompt.

  2. Run the following commands:

    #To use Windows credentials for proxy authentication
    [System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
    
    #Alternatively, to prompt for separate credentials that can be used for #proxy authentication
    [System.Net.WebRequest]::DefaultWebProxy.Credentials = Get-Credential
    
Use the Az module

You can still use the cmdlets and code samples based on AzureRM modules. However, you must change the name of the modules and cmdlets. The module names were changed such that AzureRM and Azure become Az, and the same for cmdlets. For example, the AzureRM.Compute module was renamed to Az.Compute. New-AzureRMVM is New-AzVM, and Get-AzureStorageBlob is now Get-AzStorageBlob.

For a more thorough discussion and guidance for moving AzureRM scripts to Az and information about breaking changes in Azure Stack Hub's Az module, see Migrate from AzureRM to Azure PowerShell Az.

Known issues Error thrown when installing the Az modules When installing Az module falsely throws Admin rights required error Cmdlet New-AzVmss fails when using 2020-09-01-hybrid profile Error thrown when running a PowerShell script Error thrown with New-AzADServicePrincipal and New-AzADApplication Next steps

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4