question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

creating a vm, then deleting, then creating with same name fails.

See original GitHub issue

Description

I created a resource group, created a VM inside that group, but forgot to add --ssh-key-value so i deleted the vm. I tried to create another one with the same name and that failed. I believe it was because some automagically created resource already existed.

Heres the basic recreate:

$ az group create --location=eastus2 --name=mygroup
$ az vm create --resource-group=mygroup --name=myvm --image=UbuntuLTS

# realize i messed up, so delete it.
$ az vm delete --resource-group=mygroup --name=myvm

# now try the same cmd above but with --ssh-key-value
$ az vm create --resource-group=mygroup --name=smx1 -image UbuntuLTS \
    --ssh-key-value="$key"
Deployment failed. {
  "status": "Failed",
  "error": {
    "code": "ResourceDeploymentFailure",
    "message": "The resource operation completed with terminal provisioning state 'Failed'.",
    "details": [
      {
        "code": "ConflictingUserInput",
        "message": "Disk osdisk_b7660b2ba9 already exists in resource group MYGROUP. Only CreateOption.Attach is supported."
      }
    ]
  }
}

Environment summary

Install Method: How did you install the CLI?
Answer here:

curl -L https://aka.ms/InstallAzureCli | bash

CLI Version: What version of the CLI and modules are installed? (Use az --version)
Answer here:

# az --version
azure-cli (2.0.9)

acr (2.0.7)
...

acs (2.0.9)
appservice (0.1.9)
batch (3.0.2)
billing (0.1.2)
cdn (0.0.5)
cloud (2.0.5)
cognitiveservices (0.1.5)
command-modules-nspkg (2.0.0)
component (2.0.6)
configure (2.0.9)
consumption (0.1.2)
core (2.0.10)
cosmosdb (0.1.9)
dla (0.0.9)
dls (0.0.9)
feedback (2.0.5)
find (0.2.5)
interactive (0.3.5)
iot (0.1.8)
keyvault (2.0.7)
lab (0.0.7)
monitor (0.0.7)
network (2.0.9)
nspkg (3.0.0)
profile (2.0.7)
rdbms (0.0.4)
redis (0.2.6)
resource (2.0.9)
role (2.0.7)
sf (1.0.4)
sql (2.0.6)
storage (2.0.9)
vm (2.0.9)

Python (Linux) 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609]

Python location '/root/lib/azure-cli/bin/python'

OS Version: What OS and version are you using?
Answer here: Ubuntu 16.04

Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here: bash

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
adewaleocommented, Dec 19, 2018

@smoser, I couldn’t reproduce this issue. I created a vm, deleted it and was able to successfully recreate it. It is very likely this issue has already been fixed in a previous PR, seeing this issue was opened for version 2.0.9 and the latest version of the CLI is 2.0.53. Also the vm names in your scenario aren’t consistent, I am assuming that that was a typo, and you actually attempted to recreate the first VM.

I will be closing this issue. Please let me know if you have any questions or if this is still an issue for you.

0reactions
adewaleocommented, Jul 3, 2019

@sistoimenov, what version of the CLI are you on?

I just retried and couldn’t reproduce this issue on the latest version of the cli (2.0.68 / dev branch)

(cli-venv) [10:21 AM] Work-Mac:azure-cli tosin$ az group create -n test-vm-issue -l westus
{
  "id": "/subscriptions/0000/resourceGroups/test-vm-issue",
  "location": "westus",
  "managedBy": null,
  "name": "test-vm-issue",
  "properties": {
    "provisioningState": "Succeeded"
  },
  "tags": null,
  "type": null
}
(cli-venv) [10:22 AM] Work-Mac:azure-cli tosin$ az vm create -g test-vm-issue -n ubuntu-vm --image ubuntults
{
  "fqdns": "",
  "id": "/subscriptions/0000/resourceGroups/test-vm-issue/providers/Microsoft.Compute/virtualMachines/ubuntu-vm",
  "location": "westus",
  "macAddress": "00-0D-3A-36-73-4E",
  "powerState": "VM running",
  "privateIpAddress": "10.0.0.4",
  "publicIpAddress": "104.40.80.36",
  "resourceGroup": "test-vm-issue",
  "zones": ""
}
(cli-venv) [10:24 AM] Work-Mac:azure-cli tosin$ az vm delete -n ubuntu-vm -g test-vm-issue
Are you sure you want to perform this operation? (y/n): y
(cli-venv) [10:25 AM] Work-Mac:azure-cli tosin$ 
(cli-venv) [10:26 AM] Work-Mac:azure-cli tosin$ 
(cli-venv) [10:26 AM] Work-Mac:azure-cli tosin$ az vm create -g test-vm-issue -n ubuntu-vm --image ubuntults
{
  "fqdns": "",
  "id": "/subscriptions/0000/resourceGroups/test-vm-issue/providers/Microsoft.Compute/virtualMachines/ubuntu-vm",
  "location": "westus",
  "macAddress": "00-0D-3A-36-73-4E",
  "powerState": "VM running",
  "privateIpAddress": "10.0.0.4",
  "publicIpAddress": "104.40.54.31",
  "resourceGroup": "test-vm-issue",
  "zones": ""
}
(cli-venv) [10:28 AM] Work-Mac:azure-cli tosin$ az --version
azure-cli                         2.0.68

command-modules-nspkg               2.0.3
core                              2.0.68
nspkg                              3.0.4
telemetry                          1.0.3
testsdk                            0.2.4

Extensions:
alias                              0.5.2
aks-preview                        0.4.5
vm-repair                          0.1.0

Python location '/Users/tosin/Repos/my_venvs/cli-venv/bin/python'
Extensions directory '/Users/tosin/.azure/devcliextensions'

Python (Darwin) 3.7.3 (default, Mar 27 2019, 09:23:15) 
[Clang 10.0.1 (clang-1001.0.46.3)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.
(cli-venv) [10:28 AM] Work-Mac:azure-cli tosin$ 
Read more comments on GitHub >

github_iconTop Results From Across the Web

A Same Name "Cloud Service" will be created when create ...
A. It's a wrapper for the deployment of the Virtual Machine and essentially the same construct you get for Web and Worker role...
Read more >
Troubleshooting Machines That Are Repeatedly Deleted and ...
A linked-clone or full-clone machine is created in an Error state, deleted, and recreated in an Error state. This cycle keeps repeating. Cause....
Read more >
Cannot add Virtual Machine in Hyper-V (Error: "Object might ...
In that folder, I created two folders, "VHD" and "VM". I then went into the Hyper-V Settings and changed the default VHD storage...
Read more >
4 Known Issues with the Oracle Database Appliance
If you delete a 11.2.0.4 database, and then create a new database with same name as the deleted database, database creation hangs while...
Read more >
community.vmware.vmware_guest module – Manages virtual ...
This module can be used to create new virtual machines from templates ... If multiple virtual machines with same name exists, then folder...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found