posted by jgpaper 2017. 10. 26. 13:49

Azure Stack에서는 Custom 이미지를 만들 올리 있으며, 이미지는 Azure Resource Manager 템플릿에서 참조하거나 Azure Marketplace 항목으로 추가 할 수 있습니다.

시작 준비 사항

  • Azure Stack PowerShell 설치
  • Azure Stack 작업 도구 설치
  • Windows 또는 Linux custom image VHD 파일(VHDX 파일은 안됨)

 

 

PowerShell 이용하여 VM 이미지를 추가하는 방법

 

Windows Server 2016으로 VHD 파일을 만들어서 추가 하겠습니다. 가상 컴퓨터를 만들고 Sysprep 사용하여 초기화 합니다.

 

 

PowerShell 열고 AzureStack-Tools-master로 이동 Azure Stack Marketplace 사용을 위해 아래 모듈을 import 합니다.

Set-ExecutionPolicy RemoteSigned

# Import the Connect and ComputeAdmin modules.

Import-Module .\Connect\AzureStack.Connect.psm1

Import-Module .\ComputeAdmin\AzureStack.ComputeAdmin.psm1

 

 

 

여기서는 Azure AD 기준으로 설명 하겠습니다.

 

# Import the Connect and ComputeAdmin modules.

Import-Module .\Connect\AzureStack.Connect.psm1

Import-Module .\ComputeAdmin\AzureStack.ComputeAdmin.psm1

 

# For Azure Stack Development Kit, this value is set to https://adminmanagement.local.azurestack.external. To get this value for Azure Stack integrated systems, contact your service provider.

$ArmEndpoint = "https://adminmanagement.local.azurestack.external"

 

# For Azure Stack Development Kit, this value is set to https://graph.windows.net/. To get this value for Azure Stack integrated systems, contact your service provider.

$GraphAudience = "https://graph.windows.net/"

 

# Create the Azure Stack operator's Azure Resource Manager environment by using the following cmdlet:

Add-AzureRMEnvironment `

  -Name "AzureStackAdmin" `

  -ArmEndpoint $ArmEndpoint

 

Set-AzureRmEnvironment `

  -Name "AzureStackAdmin" `

  -GraphAudience $GraphAudience

 

$TenantID = Get-AzsDirectoryTenantId `

  -AADTenantName "domain.onmicrosoft.com" `

  -EnvironmentName AzureStackAdmin

 

Login-AzureRmAccount `

  -EnvironmentName "AzureStackAdmin" `

  -TenantId $TenantID

 

ArmEndpoint Azure Stack Development Kit 경우에는  https://adminmanagement.local.azurestack.external 입력합니다. , GraphAudience Azure Stack Development Kit 경우  https://graph.windows.net/ 입력 합니다.

 

 

 

로그인 창이 나타나면 Azure Stack 관리자 ID 로그인 합니다.

 

 

 

Add-AzsVMImagecmdlet 호출하여 VM 이미지를 추가 합니다. Add-AzsVMImage cmdlet에서 osType Windows 또는 Linux로 지정하고, VM 이미지의 publisher, offer, SKU 및 버전을 넣습니다.

 

Add-AzsVMImage `

-publisher "Microsoft" `

-offer "WindowsServer" `

-sku "Datacenter2016" `

-version "1.0.0" `

-osType Windows `

-osDiskLocalPath 'C:\Users\AzureStackAdmin\Desktop\WindowsServer2016.vhd'

 

 

위의 PowerShell 명령을 실행 하면 VHD image 업로드가 시작 됩니다.

 

 

 

Azure Stack 관리자 Portal 에서도 생성되고 있는 것을 확인 할 수 있습니다.

 

 

 

정상적으로 VHD image 업로드 되면 "StatusCode : Created" 표시 됩니다.

 

 

그리고, Azure Stack 관리자 포탈에서도 STATUS 가 "Succeeded" 로 확인 할 수 있습니다.

 

 

 

여기서 업로드 한 VHD는 약 127GB 이고 업로드 되는데 약 70분 정도가 소요 되었습니다. 이 것은 하드웨어 및 환경에 따라 차이가 발생합니다.

 

위에서 추가한 VHD Image를 Azure Stack 사용자 포탈에서 아래와 같이 정상적으로 보입니다.

 

 

추가한 VHD image로 VM을 생성하면 정상적으로 생성되었습니다.

 

 

 

 

Azure Stack 관리자 포탈에서 VM 이미지를 추가하는 방법

 

 

방법은 포탈에서 Images 추가하는 방법으로 Azure Stack 사용자 포탈에 해당 Image 이미 배포되어 있어야 합니다. 배포 되지 않았다면 배포를 먼저 하십시오. 방법은 PowerShell 추가하는 방법보다 빠릅니다.

 

Azure Stack 사용자 포탈에서 배포 storage accounts 이동하여 해당 image 배포된 storage account 선택합니다. 그리고 "Blobs" 클릭합니다.

 

 

 

"vhds" container 클릭합니다.

 

 

여기에서 상단에 "Access policy" 선택하여 container "Access type" 을 private 에서 Blob으로 변경하고 저장합니다.

 "Access type" 을 변경하지 않으면 생성에 실패 합니다.

  

 

 추가 해당 Image 선택하면  "Blob properties" 정보가 나타납니다. 여기에서 "URL" 항목의 값을 복사 합니다.

  

 

이번에는 Azure Stack 관리자 포탈로 이동하여 "More services > Computes" 선택합니다. "VM images" 선택합니다.

상단에 "+Add" 클릭합니다.

  

  

Add a VM image 에서 Publisher, Offer, SKU, Version 값이 기존 images 중복되지 않도록 입력 합니다. "OS disk blob URL" 항목에는 앞에서 Azure stack 사용자 포탈에서 복사 VHD URL 입력 합니다. "Create " 버튼을 클릭합니다.

참고로 저는 추가 작업을 하기 전에 해당 VM 상태를 "Stop" 으로 만들었습니다.

  

 

아래 그림처럼 새롭게 이미지가 생성되어 추가 되는 것을 확인 할 수 있습니다.

  

 

 

PowerShell 추가하는 보다는 빠르지만 127GB 추가하는 55 정도 소요 되었습니다. 것은 하드웨어 사양과 환경에 따라 다릅니다.

 

자세한 내용은 Make a custom virtual machine image available in Azure Stack 사이트를 방문 하십시오.