Adding existing VMs to Azure Stack

If you need to add existing VMs to Azure Stack. The process of adding new base images is described as follows and is quite similar to that of adding a new base OS:

  1. Log on to a computer with Azure PowerShell and Azure Stack PowerShell tools installed. In addition, we need the PowerShell tools for Azure Stack too.
  2. Import the Azure Stack Connect and ComputeAdmin PowerShell module to your administrative PowerShell ISE, as follows:
      Import-Module .ConnectAzureStack.Connect.psm1
      Import-Module .ComputeAdminAzureStack.ComputeAdmin.psm1
  1. Create the Azure Stack cloud administrator's AzureRM environment:
      Add-AzureRMEnvironment `
        -Name "AzureStackAdmin" `
        -ArmEndpoint https://adminmanagement.local.azurestack.external
  1. Get the GUID from your Azure Stack tenant:
    • In connected scenarios, this is the code:
    • In disconnected scenarios, this is the code:
              $TenantID = Get-AzsDirectoryTenantId `
              -ADFS -EnvironmentName AzureStackAdmin
  1. Log in to your Azure Stack environment using the follow PowerShell command:
      Login-AzureRmAccount `
      -EnvironmentName "AzureStackAdmin" `
      -TenantId $TenantID  
  1. Add the existing image to the environment using the following PowerShell:
      Add-AzsVMImage `
        -publisher "Canonical" `
        -offer "UbuntuServer" `
        -sku "14.04.3-LTS" `
        -version "1.0.0" `
        -osType Linux `
        -osDiskLocalPath
'C:UsersAzureStackAdminDesktopUbuntuServer.vhd'

The PowerShell command does the following steps:

  1. Authenticates to the Azure Stack environment.
  2. Uploads the local VHD to a newly created temporary storage account.
  3. Adds the VM image to the VM image repository.
  4. Creates a Marketplace item.

Parameter

Description

publisher

The publisher name segment of the VM image that user's use when deploying the image. An example is Microsoft. Do not include a space or other special characters in this field.

offer

The offer name segment of the VM image that user's use when deploying the VM image. An example is WindowsServer. Do not include a space or other special characters in this field.

sku

The sku name segment of the VM image that user's use when deploying the VM image. An example is Datacenter2016. Do not include a space or other special characters in this field.

version

The version of the VM image that user's use when deploying the VM image. This version is in the format #.#.#. An example is 1.0.0. Do not include a space or other special characters in this field.

osType

The osType of the image must be either Windows or Linux.

osDiskLocalPath

The local path to the OS disk VHD that you are uploading as a VM image to Azure Stack.

dataDiskLocalPaths

An optional array of the local paths for data disks that can be uploaded as part of the VM image.

CreateGalleryItem

A Boolean flag that determines whether to create an item in Marketplace. By default, it is set to true.

title

The title name of Marketplace item. By default, it is set to the publisher-offer-sku of the VM image.

description

The description of the Marketplace item.

location

The location to which the VM image should be published. By default, this value is set to local.

osDiskBlobURI

Optionally, this script also accepts a Blob storage URI for osDisk.

dataDiskBlobURIs

Optionally, this script also accepts an array of Blob storage URIs in order to add data disks to the image.

To add other distributions to Azure Stack, follow this article for all the details: https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-linux.

To remove an existing VM from the Marketplace, the PowerShell will change to the following:

    Remove-AzsVMImage `
      -publisher "Canonical" `
      -offer "UbuntuServer" `
      -sku "14.04.3-LTS" `
      -version "1.0.0"   
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.102.118