Uploading the default Image : API version diffrence RRS feed

  • Question

  • Trying to upload the default image to market place from MAS-CON VM using PS:>New-Server2016VMImage -ISOPath $ISOPath -TenantId $AADTenantID. The iso  image used is window server 2016 image.

    The execution is as follows :

    VERBOSE: Checking ISO path for a valid ISO.
    VERBOSE: Checking authorization against your Azure Stack environment
    VERBOSE: Authorization verified
    VERBOSE: Creating Server Full Image
    VERBOSE: Creating VHD at: C:\Azuretools\AzureStack-Tools-master\ComputeAdmin\Server2016DatacenterFullEval.vhd of size:
    40960 MB
    VERBOSE: Preparing VHD
    VERBOSE: VHD is mounted at drive letter: E
    VERBOSE: Mounting ISO
    VERBOSE: ISO is mounted at drive letter: F
    VERBOSE: Applying Image Windows Server 2016 SERVERDATACENTER to VHD
    VERBOSE: Making VHD bootable
    New-AzureRmResourceGroup : Operation returned an invalid status code 'BadRequest'
    At C:\Azuretools\AzureStack-Tools-master\ComputeAdmin\AzureStack.ComputeAdmin.psm1:127 char:9
    +         New-AzureRmResourceGroup -Name $resourceGroupName -Location $ ...
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [New-AzureRmResourceGroup], CloudException
        + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupCmd

    New-AzureRmStorageAccount : The resource type 'checkNameAvailability' could not be found in the namespace
    'Microsoft.Storage' for api version '2016-12-01'. The supported api-versions are
    At C:\Azuretools\AzureStack-Tools-master\ComputeAdmin\AzureStack.ComputeAdmin.psm1:133 char:27
    + ... geAccount = New-AzureRmStorageAccount -Name $storageAccountName -Loca ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [New-AzureRmStorageAccount], CloudException
        + FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.NewAzureStorageAccountCommand

    Set-AzureRmCurrentStorageAccount : Resource group 'addvmimageresourcegroup' could not be found.
    At C:\Azuretools\AzureStack-Tools-master\ComputeAdmin\AzureStack.ComputeAdmin.psm1:135 char:5
    +     Set-AzureRmCurrentStorageAccount -StorageAccountName $storageAcco ...
    +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Set-AzureRmCurrentStorageAccount], CloudException
        + FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.SetAzureRmCurrentStorageAccount

    New-Server2016VMImage : Could not get the storage context.  Please pass in a storage context or set the current
    storage context.
    At line:1 char:1
    + New-Server2016VMImage -ISOPath $ISOPath -TenantId $AADTenantID
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Write-Error], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,New-Server2016VMImage

                                                                 The AzureStack module verion is 1.2.9, AzureRM.Storage version is 2.7.0, AzureRM.Resources  version 3.7.0

    Is there any way to get out of API mismatch error.

    Thanks & Regards,


    • Edited by Isahac Friday, March 24, 2017 11:39 AM
    Friday, March 24, 2017 11:34 AM

All replies

  • I had similar issues.

    Gary Gallanes replied to my post on the subject: 

    "We found the issue to be with the Azure Stack-Tools module & older versions of Azure Resource Manager module.

    Please remove the old Azure Stack tools and Azure Resource Manager modules and download/install the latest version (1.28)


    ### Uninstall Azure Modules, Download, Install and Import AzureRM Module


    Get-Module -ListAvailable | where-Object ($_.Name -like “Azure*”) | Uninstall-Module

    Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted

        $AzureModule = "c:\Program Files\WindowsPowerShell\Modules\AzureRM\1.2.8\AzureRM.psd1"

        if (Test-Path $AzureModule){

            Import-Module $AzureModule -Global

              } else {

                    Install-Module -Name AzureRM -RequiredVersion 1.2.8


        Import-Module $AzureModule -Global -Erroraction SilentlyContinue


    ### Download, Install and Import AzureStack-Tools Module

    cd C:\Windows\System32\WindowsPowerShell\v1.0\Modules

    invoke-webrequest https://github.com/Azure/AzureStack-Tools/archive/master.zip -OutFile master.zip

    expand-archive master.zip -DestinationPath . -Force"

    See if that helps?

    Friday, March 24, 2017 11:49 AM
  • Thanks  Gary, Sure will try that..



    Friday, March 24, 2017 2:58 PM