New-AzureQuickVM Service already exists, Location cannot be specified

Resolved: New-AzureQuickVM Service already exists

The New-AzureQuickVM cmdlet is a quick and easy way to create and provision a new Azure virtual machine.

You may have a script setup to provision new Azure VM’s like the one below:

$adminUser = "user123"
$password = "P@$$w0rd"
$serviceName = "jakesNewService"
$location = "South Central US"
$size = "Small"
$vmName = "jakessecondVM"

$imageName = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201505.01-en.us-127GB.vhd"

New-AzureQuickVM    -Windows `
                    -ServiceName $serviceName `
                    -Name $vmName `
                    -ImageName $imageName `
                    -AdminUsername $adminUser `
                    -Password $password `
                    -Location $location `
                    -InstanceSize $size

The first time utilizing this command may work seamlessly but subsequent uses result in the following error:

New-AzureQuickVM Service already exists, Location cannot be specified.
At T:\SysAdmin\Azure\PS\VMs\QuickVM.ps1:10 char:1
+ New-AzureQuickVM    -Windows `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureQuickVM], ApplicationException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.PersistentVMs.NewQuickVM

Reason: New-AzureQuickVM will fail if you specify the location and also if the cloud service name specify in ServiceName already exists.

Simply remove the -Location parameter and re-run the script.

Alternatively you can use the New-AzureVM cmdlet which doesn’t encounter this issue.

1 Response

  1. liam says:

    This worked for me. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *