I use a powershell script to create a virtual machine in azure.
The script goes like this :
$serviceName = 'nameOfTheService'
$vmName = 'nameOfTheVM'
$osDiskName = 'nameOfTheDisk'
$config = New-AzureVMConfig -Name $vmName -DiskName $osDiskName -InstanceSize $size | Add-AzureEndPoint -Name 'Remote Desktop' -LocalPort 3389 -PublicPort 3389 -Protocol tcp
New-AzureVM -ServiceName $serviceName -Location $location -VMs $config
First time runs just fine.
If I delete the VM and re-run the script, it says that "the specified DNS name is already take", wich is true because I did not deleted the cloud service.
Is there a way I can reuse the existing cloud service when creating the machine?