Azure Stack Hub용 PowerShell AzureRM 모듈 설치

Azure PowerShell AzureRM(Azure Resource Manager)은 Azure Stack Hub 리소스를 관리하기 위해 Azure Resource Manager 모델을 사용하는 cmdlet 집합을 제공합니다.

중요

오래된 버전의 Azure Stack Hub PowerShell에 대한 웹 페이지에 도달했습니다. AzureRM(Azure Resource Manager) PowerShell 모듈의 모든 버전은 오래되었으며 지원되지 않습니다. AzureRM 모듈은 향후 Azure Stack Hub 빌드에서 더 이상 업데이트되지 않습니다. Az 모듈은 빌드 2002 이상에 사용해야 합니다. AzureRM 모듈에는 2020-09-01-hybrid 프로필이 지원되지 않습니다.

이제는 Azure 및 Azure Stack Hub와 상호 작용할 때 PowerShell 모듈로 Az PowerShell 모듈을 사용하는 것이 좋습니다. Az PowerShell 모듈을 시작하려면 Azure Stack Hub용 PowerShell Az 미리 보기 모듈 설치를 참조하세요. Az PowerShell 모듈로 마이그레이션하는 방법을 알아보려면 다음을 수행합니다. Azure Stack Hub에서 AzureRM으로부터 Azure PowerShell Az로 마이그레이션을 참조하세요. 글로벌 Azure에서 채택된 Az 모듈의 향상된 기능에 대한 자세한 내용은 Azure Az PowerShell 모듈 소개를 참조하세요.

또한 API 프로필을 사용하여 Azure Stack Hub 리소스 공급자에 대해 호환되는 엔드포인트를 지정해야 합니다.

API 프로필은 Azure와 Azure Stack Hub 간의 버전 차이를 관리하는 방법을 제공합니다. API 버전 프로필은 특정 API 버전을 사용하는 Azure Resource Manager PowerShell 모듈 집합입니다. 각 클라우드 플랫폼에는 지원되는 API 버전 프로필 집합이 있습니다. 예를 들어 Azure Stack Hub는 2019-03-01-hybrid와 같은 특정 프로필 버전을 지원합니다. 프로필을 설치하면 지정된 프로필에 해당하는 Azure Resource Manager PowerShell 모듈이 설치됩니다.

인터넷에 연결되거나 부분적으로 연결되거나 연결이 끊긴 시나리오에서 Azure Stack Hub 호환 PowerShell 모듈을 설치할 수 있습니다. 이 문서에서는 이러한 시나리오에 대한 자세한 지침을 안내합니다.

Docker 컨테이너에서 Azure Stack Hub에 대한 Azure Resource Manager 모듈을 실행할 수도 있습니다. 자세한 내용은 Docker를 사용하여 Azure Stack Hub용 PowerShell 실행을 참조하세요.

1. 필수 구성 요소 확인

Azure Stack Hub 및 PowerShell Azure Resource Manager 모듈을 시작하기 전에 다음 필수 구성 요소가 있어야 합니다.

  • PowerShell 버전 5.1
    버전을 검사 $PSVersionTable.PSVersion을 실행하고 버전을 비교합니다. PowerShell 5.1이 없는 경우 설치 Windows PowerShell 따릅니다.

    참고

    PowerShell 5.1에는 Windows 컴퓨터가 필요합니다.

  • 관리자 권한 명령 프롬프트에서 PowerShell을 실행합니다.

  • 액세스 PowerShell 갤러리
    PowerShell 갤러리 액세스해야 합니다. 갤러리는 PowerShell 콘텐츠의 중앙 리포지토리입니다. PowerShellGet 모듈에는 PowerShell 아티팩트를 검색, 설치, 업데이트 및 게시하기 위한 cmdlet이 포함되어 있습니다. 이러한 아티팩트 예로는 PowerShell 갤러리 및 기타 프라이빗 리포지토리의 모듈, DSC 리소스, 역할 기능 및 스크립트가 있습니다. 연결이 끊긴 시나리오에서 PowerShell을 사용하는 경우 인터넷에 연결된 컴퓨터에서 리소스를 검색하고 연결이 끊긴 컴퓨터에서 액세스할 수 있는 위치에 저장해야 합니다.

PSGallery가 리포지토리로 등록되었는지 확인합니다.

참고

이 단계에서는 인터넷에 액세스해야 합니다.

관리자 권한 PowerShell 프롬프트를 열고 다음 cmdlet을 실행합니다.

Install-module -Name PowerShellGet -Force
Import-Module -Name PackageManagement -ErrorAction Stop
Get-PSRepository -Name "PSGallery"

리포지토리가 등록되지 않은 경우 관리자 권한 PowerShell 세션을 열고 다음 명령을 실행합니다.

Register-PSRepository -Default
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted

3. Azure Stack Hub PowerShell 모듈의 기존 버전 제거

필요한 버전을 설치하기 전에 이전에 설치한 Azure Stack Hub Azure Resource Manager PowerShell 모듈을 제거해야 합니다. 다음 두 가지 방법 중 하나를 사용하여 모듈을 제거합니다.

  1. 기존 Azure Resource Manager 및 Az PowerShell 모듈을 제거하려면 활성 PowerShell 세션을 모두 닫고 다음 cmdlet을 실행합니다.

    Get-Module -Name Azure* -ListAvailable | Uninstall-Module -Force -Verbose -ErrorAction Continue
    Get-Module -Name Azs.* -ListAvailable | Uninstall-Module -Force -Verbose -ErrorAction Continue
    Get-Module -Name Az.* -ListAvailable | Uninstall-Module -Force -Verbose -ErrorAction Continue
    

    '모듈이 이미 사용 중'과 같은 오류가 발생하면 모듈을 사용하는 PowerShell 세션을 닫고 위의 스크립트를 다시 실행합니다.

  2. 로 시작하는 Azure모든 폴더를 삭제하거나 Azs.C:\Users\{yourusername}\Documents\WindowsPowerShell\Modules 폴더에서 C:\Program Files\WindowsPowerShell\Modules 삭제 Az 합니다. 이러한 폴더를 삭제하면 기존 PowerShell 모듈이 제거됩니다.

4. 연결됨: 인터넷 연결을 사용하여 Azure Stack Hub용 PowerShell 설치

필요한 API 버전 프로필 및 Azure Stack Hub PowerShell 모듈은 실행 중인 Azure Stack Hub 버전에 따라 달라집니다.

Azure Stack Hub PowerShell 설치

다음 PowerShell 스크립트를 실행하여 개발 워크스테이션에 이러한 모듈을 설치합니다.

Azure Stack Hub 2002 이상:

사용자 AzureRm 모듈 또는 Az 미리 보기 모듈을 사용할 수 있습니다. Az 모듈을 사용하려면 Azure Stack Hub 2002 이상이 필요합니다.

Az 미리 보기 모듈을 사용하려면 PowerShell Az 모듈 설치의 지침을 따릅니다.

# Install the AzureRM.BootStrapper module. Select Yes when prompted to install NuGet
Install-Module -Name AzureRM.BootStrapper

# Install and import the API Version Profile required by Azure Stack Hub into the current PowerShell session.
Use-AzureRmProfile -Profile 2019-03-01-hybrid -Force
Install-Module -Name AzureStack -RequiredVersion 1.8.3 

Azure Stack Hub 1910의 경우:

# Install the AzureRM.BootStrapper module. Select Yes when prompted to install NuGet
Install-Module -Name AzureRM.BootStrapper

# Install and import the API Version Profile required by Azure Stack Hub into the current PowerShell session.
Use-AzureRmProfile -Profile 2019-03-01-hybrid -Force
Install-Module -Name AzureStack -RequiredVersion 1.8.0

참고

Azure Stack Hub 1908 이하의 경우:

# Install the AzureRM.BootStrapper module. Select Yes when prompted to install NuGet
Install-Module -Name AzureRM.BootStrapper

# Install and import the API Version Profile required by Azure Stack Hub into the current PowerShell session.
Use-AzureRmProfile -Profile 2019-03-01-hybrid -Force
Install-Module -Name AzureStack -RequiredVersion 1.7.2

참고

Azure Stack Hub 모듈 버전 1.7.2는 호환성이 손상되는 변경 릴리스입니다. Azure Stack Hub 1.6.0에서 마이그레이션하려면 마이그레이션 가이드를 참조하세요.

PowerShell 설치 확인

다음 명령을 실행하여 설치를 확인합니다.

Get-Module -Name "Azure*" -ListAvailable
Get-Module -Name "Azs*" -ListAvailable

설치에 성공 AzureRm 하면 및 AzureStack 모듈이 출력에 표시됩니다.

5. 연결이 끊김: 인터넷 연결 없이 PowerShell 설치

연결이 끊긴 시나리오에서는 먼저 인터넷에 연결된 컴퓨터에 PowerShell 모듈을 다운로드합니다. 그런 다음 설치를 위해 ASDK(Azure Stack Development Kit)로 전송합니다.

인터넷에 연결된 컴퓨터에 로그인하고 다음 스크립트를 사용하여 Azure Stack Hub 버전에 따라 Azure Resource Manager 및 Azure Stack Hub 패키지를 다운로드합니다.

설치에는 다음 5단계가 있습니다.

  1. 연결된 컴퓨터에 Azure Stack Hub PowerShell을 설치합니다.
  2. 추가 스토리지 기능을 사용하도록 설정합니다.
  3. PowerShell 패키지를 연결이 끊긴 워크스테이션으로 전송합니다.
  4. 연결이 끊긴 워크스테이션에서 NuGet 공급자를 수동으로 부트스트랩합니다.
  5. PowerShell 설치를 확인합니다.

Azure Stack Hub PowerShell 설치

Azure Stack Hub 2002 이상.

Azure Resource Manager 또는 Az preview 모듈을 사용할 수 있습니다. Az 모듈의 경우 PowerShell Az 모듈 설치의 지침을 참조하세요.


Install-module -Name PowerShellGet -Force 
Import-Module -Name PackageManagement -ErrorAction Stop

$Path = "<Path that is used to save the packages>"
Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name AzureRM -Path $Path -Force -RequiredVersion 2.5.0
Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name AzureStack -Path $Path -Force -RequiredVersion 1.8.3

Azure Stack Hub 1910.

Install-module -Name PowerShellGet -Force 
Import-Module -Name PackageManagement -ErrorAction Stop

$Path = "<Path that is used to save the packages>"
Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name AzureRM -Path $Path -Force -RequiredVersion 2.5.0
Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name AzureStack -Path $Path -Force -RequiredVersion 1.8.0

참고

Azure Stack Hub 모듈 버전 1.8.0은 호환성이 손상되는 변경 릴리스입니다. 자세한 내용은 릴리스 정보를 참조하세요 .

Azure Stack Hub 1908 이하의 경우:

Install-module -Name PowerShellGet -Force 
Import-Module -Name PackageManagement -ErrorAction Stop

$Path = "<Path that is used to save the packages>"
Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name AzureRM -Path $Path -Force -RequiredVersion 2.5.0
Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name AzureStack -Path $Path -Force -RequiredVersion 1.7.2

참고

Azure Stack Hub 모듈 버전 1.7.1은 호환성이 손상되는 변경입니다. Azure Stack Hub 1.6.0에서 마이그레이션하려면 마이그레이션 가이드를 참조하세요.

참고

인터넷 연결이 없는 컴퓨터에서는 원격 분석 데이터 수집을 사용하지 않도록 설정하기 위해 다음 cmdlet을 실행하는 것이 좋습니다. 원격 분석 데이터 수집을 사용하지 않도록 설정하지 않고 cmdlet의 성능 저하가 발생할 수 있습니다. 인터넷 연결이 없는 컴퓨터에만 적용됩니다.

Disable-AzureRmDataCollection

워크스테이션에 패키지 추가

  1. 다운로드한 패키지를 USB 디바이스에 복사합니다.

  2. 연결이 끊긴 워크스테이션에 로그인하고 USB 디바이스의 패키지를 워크스테이션의 위치로 복사합니다.

  3. 연결이 끊긴 워크스테이션에서 NuGet 공급자를 수동으로 부트스트랩합니다. 지침은 인터넷에 연결되지 않은 컴퓨터에서 NuGet 공급자를 수동으로 부트스트래핑을 참조하세요.

  4. 이 위치를 기본 리포지토리로 등록하고 이 리포지토리에서 Azure Resource Manager 및 AzureStack 모듈을 설치합니다.

    # requires -Version 5
    # requires -RunAsAdministrator
    # requires -Module PowerShellGet
    # requires -Module PackageManagement
    
    $SourceLocation = "<Location on the development kit that contains the PowerShell packages>"
    $RepoName = "MyNuGetSource"
    
    Register-PSRepository -Name $RepoName -SourceLocation $SourceLocation -InstallationPolicy Trusted
    
    Install-Module -Name AzureRM -Repository $RepoName
    
    Install-Module -Name AzureStack -Repository $RepoName
    

PowerShell 설치 확인

다음 명령을 실행하여 설치를 확인합니다.

Get-Module -Name "Azure*" -ListAvailable
Get-Module -Name "Azs*" -ListAvailable

6. 프록시 서버를 사용하도록 PowerShell 구성

프록시 서버가 인터넷에 액세스해야 하는 시나리오에서는 먼저 기존 프록시 서버를 사용하도록 PowerShell을 구성합니다.

  1. 관리자 권한 PowerShell 프롬프트를 엽니다.

  2. 다음 명령을 실행합니다.

    #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
    

알려진 문제

메서드 get_SerializationSettings 오류

  • 원인: PowerShell Az 모듈 및 PowerShell Azure Resource Manager 모듈은 호환되지 않습니다.

    다음 오류는 Azure Resource Manager 모듈 및 Az 모듈이 동일한 세션에서 로드됨을 나타냅니다.

    >  Method 'get_SerializationSettings' in type 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly 'Microsoft.Azure.Commands.ResourceManager.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does 
    not have an implementation.
    
  • 수정: 충돌하는 모듈을 제거합니다.

    Azure Resource Manager 모듈을 사용하려면 Az 모듈을 제거합니다. 또는 Az 모듈을 사용하려는 경우 Azure Resource Manager 제거합니다. PowerShell 세션을 닫고 Az 또는 Azure Resource Manager 모듈을 제거합니다.

    Azure Stack Hub PowerShell 모듈의 기존 버전 제거에서 지침을 찾을 수 있습니다.

NewAzureRMADServicePrincipal 및 NewAzureRMAdApplication으로 throw된 오류

  • 적용 가능: Microsoft Entra ID 사용하는 Azure Stack 환경.

  • 원인: Azure Active Directory Graph는 Active Directory 애플리케이션이 디렉터리에서 확인된 도메인의 하위 도메인이 되도록 제한하는 IdentifierUri 호환성이 손상되는 변경을 도입했습니다. 변경 전에 이 제한은 다중 테넌트 앱에만 적용되었습니다. 이제 이 제한은 단일 테넌트 앱에도 적용됩니다. 변경으로 인해 다음과 같은 오류가 발생합니다 Values of identifierUris property must use a verified domain of the organization or its subdomain' is displayed when running.

  • 수정: 두 가지 방법으로 이 제한을 해결할 수 있습니다.

    • 디렉터리 테넌트의 하위 도메인인 서비스 주체 이름을 사용해야 합니다. 예를 들어 디렉터리가 contoso.onmicrosoft.com인 경우 서비스 주체 이름은 형식 <foo>.contoso.onmicrosoft.com이어야 합니다. 다음 cmdlet을 사용합니다.

      NewAzureRMADServicePrincipal -Role Owner -DisplayName <foo>.contoso.onmicrosoft.com
      

      AZURE Stack Hub에서 ID 및 서비스 주체 사용에 대한 자세한 내용은 Azure Stack Hub에 대한 ID 공급자 개요를 참조하세요.

    • 유효한 IdentifierUri 를 제공하는 Microsoft Entra 앱을 만든 다음, 다음 cmdlet을 사용하여 앱과 연결된 서비스 주체를 만듭니다.

      $app=NewAzureRMAdApplication -DisplayName 'newapp' -IdentifierUris http://anything.contoso.onmicrosoft.com
      NewAzureRMADServicePrincipal -Role Owner -ApplicationId $app.ApplicationId
      
  • 발생: 일반

다음 단계