Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.23k stars 3.83k forks source link

Need to fix the error message returned by Compute when creating a vm using an image that is not in the same region #6081

Closed praries880 closed 5 years ago

praries880 commented 6 years ago

As of now when i try to create a vm with an image that is in a different region,the cmdlet fails with the following error :

new-azurermvm : The Image 'ParyTest1-image' cannot be found.
At line:1 char:1

We need to fix the error message to something that is more informative and accurate ,something like :

The image exists in a different region (<image region name>) and can not be used to create a vm in the region <region passed in>).

Heres the complete command :


PS D:\Public\azure-powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.Compute> new-azurermvm -Ima
ge /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ParyTest1/providers/Microsoft.Compute/images/ParyT
est1-image -Location 'South Central US'

cmdlet New-AzureRmVM at command pipeline position 1
Supply values for the following parameters:
Name: pa1
Credential
VERBOSE: ResourceGroupName = "pa1"
VERBOSE: Location = "South Central US"
VERBOSE: Zone = $null
VERBOSE: Name = "pa1"
VERBOSE: Credential = System.Management.Automation.PSCredential
VERBOSE: VirtualNetworkName = "pa1"
VERBOSE: AddressPrefix = "192.168.0.0/16"
VERBOSE: SubnetName = "pa1"
VERBOSE: SubnetAddressPrefix = "192.168.1.0/24"
VERBOSE: PublicIpAddressName = "pa1"
VERBOSE: DomainNameLabel = "pa1-b881ed"
VERBOSE: AllocationMethod = "Static"
VERBOSE: SecurityGroupName = "pa1"
VERBOSE: OpenPorts = 3389,5985
VERBOSE: Image =
"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ParyTest1/providers/Microsoft.Compute/images/ParyTe
st1-image"
VERBOSE: Size = "Standard_DS1_v2"
VERBOSE: AvailabilitySetName = $null
VERBOSE: SystemAssignedIdentity = False
VERBOSE: UserAssignedIdentity = $null
VERBOSE: DataDiskSizeInGb = $null
new-azurermvm : The Image 'ParyTest1-image' cannot be found.
At line:1 char:1
+ new-azurermvm -Image /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureRmVM], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand

PS D:\Public\azure-powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.Compute>
Drewm3 commented 5 years ago

Cleaning up old issues from 2016 - 2018. Please reopen this issue if it is still a concern.