azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Snapshot Create always requires --Location flag. please correct

Open vnextcoder opened this issue 5 years ago • 15 comments

[Enter feedback here]


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

  • ID: fca6f8c5-a518-04ee-08e3-4ad8d4c9516e
  • Version Independent ID: 17710c8c-9cd9-57ea-b6b0-1411648ea03f
  • Content: az snapshot
  • Content Source: latest/docs-ref-autogen/snapshot.yml
  • Service: virtual-machines
  • GitHub Login: @rloutlaw
  • Microsoft Alias: routlaw

vnextcoder avatar Dec 29 '20 10:12 vnextcoder

hi @qwordy could you pls help to have a look? thanks

yungezz avatar Dec 29 '20 11:12 yungezz

Hi @vnextcoder , I run this command in my machine. No error. Location will be set as same as resource group if it is omited. Can you share your command?

az snapshot create -g fy -n s1 --size-gb 10

qwordy avatar Dec 30 '20 02:12 qwordy

Sure.

here you go

C:\>az disk list -o json --query "[].{name:name,id:id}"
[
  {
    "id": "/subscriptions/xxxxxxxxx-47bb-b93d-xxxxxxxxxxxxxx/resourceGroups/TESTRG/providers/Microsoft.Compute/disks/vm1_DataDisk_0",
    "name": "vm1_DataDisk_0"
  },
  {
    "id": "/subscriptions/xxxxxxxxx-47bb-b93d-xxxxxxxxxxxxxx/resourceGroups/TESTRG/providers/Microsoft.Compute/disks/vm1_disk1_acc969a8e3d649ef8f481d7160fb7bd7",
    "name": "vm1_disk1_acc969a8e3d649ef8f481d7160fb7bd7"
  }
]
C:\>az snapshot create -g testrg -n mysnap --source "/subscriptions/xxxxxxxxx-47bb-b93d-xxxxxxxxxxxxxx/resourceGroups/TESTRG/providers/Microsoft.Compute/disks/vm1_DataDisk_0"
ResourceNotFoundError: (NotFound) Resource vm1_DataDisk_0 is not found.

C:\>az snapshot create -g testrg -n mysnap --source "/subscriptions/xxxxxxxxx-47bb-b93d-xxxxxxxxxxxxxx/resourceGroups/TESTRG/providers/Microsoft.Compute/disks/vm1_DataDisk_0" --location westus

{
  "creationData": {
    "createOption": "Copy",
    "galleryImageReference": null,
    "imageReference": null,
    "sourceResourceId": "/subscriptions/xxxxxxxxx-47bb-b93d-xxxxxxxxxxxxxx/resourceGroups/TESTRG/providers/Microsoft.Compute/disks/vm1_DataDisk_0",
    "sourceUniqueId": "bbb39625-4707-413b-acc5-ee33166e8010",
    "sourceUri": null,
    "storageAccountId": null,
    "uploadSizeBytes": null
  },
  "diskAccessId": null,
  "diskSizeBytes": 4294967296,
  "diskSizeGb": 4,
  "encryption": {
    "diskEncryptionSetId": null,
    "type": "EncryptionAtRestWithPlatformKey"
  },
  "encryptionSettingsCollection": null,
  "hyperVGeneration": null,
  "id": "/subscriptions/xxxxxxxxx-47bb-b93d-xxxxxxxxxxxxxx/resourceGroups/testrg/providers/Microsoft.Compute/snapshots/mysnap",
  "incremental": false,
  "location": "westus",
  "managedBy": null,
  "name": "mysnap",
  "networkAccessPolicy": "AllowAll",
  "osType": null,
  "provisioningState": "Succeeded",
  "resourceGroup": "testrg",
  "sku": {
    "name": "Standard_LRS",
    "tier": "Standard"
  },
  "tags": {
    "CostCenter": "YHG"
  },
  "timeCreated": "2021-01-03T05:34:52.772488+00:00",
  "type": "Microsoft.Compute/snapshots",
  "uniqueId": "6f474f3d-6c95-4b6d-a80e-ea9fd39b4e23"
}
C:\>az --version
azure-cli                         2.17.0

core                              2.17.0
telemetry                          1.0.6

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\users\user1\.azure\cliextensions'

Python (Windows) 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy


vnextcoder avatar Jan 03 '21 05:01 vnextcoder

I hope the Bug has been found by now or the Documentation updated as necessary.

vnextcoder avatar Jan 08 '21 04:01 vnextcoder

I don't think location is required. Location is used to specify where to create snapshot. If it is omitted, it will inherit from location of resource group. It is message from service. It says it can't find /subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/fy/providers/Microsoft.Compute/disks/d1. However, it exists. The response is misleading.

azure.core.pipeline.policies._universal: Request URL: 'https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/fy/providers/Microsoft.Compute/snapshots/s1?api-version=2020-05-01'
azure.core.pipeline.policies._universal: Request method: 'PUT'
azure.core.pipeline.policies._universal: Request headers:
azure.core.pipeline.policies._universal:     'Content-Type': 'application/json'
azure.core.pipeline.policies._universal:     'Accept': 'application/json'
azure.core.pipeline.policies._universal:     'Content-Length': '255'
azure.core.pipeline.policies._universal:     'x-ms-client-request-id': 'e937fae6-607d-11eb-b31e-001a7dda7111'
azure.core.pipeline.policies._universal:     'CommandName': 'snapshot create'
azure.core.pipeline.policies._universal:     'ParameterSetName': '-g -n --source --debug'
azure.core.pipeline.policies._universal:     'User-Agent': 'AZURECLI/2.18.0 (MSI) azsdk-python-azure-mgmt-compute/18.0.0 Python/3.6.8 (Windows-10-10.0.19041-SP0)'
azure.core.pipeline.policies._universal:     'Authorization': '*****'
azure.core.pipeline.policies._universal: Request body:
azure.core.pipeline.policies._universal: {"location": "westus", "tags": {}, "sku": {"name": "Standard_LRS"}, "properties": {"creationData": {"createOption": "Copy", "sourceResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/fy/providers/Microsoft.Compute/disks/d1"}}}
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "PUT /subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/fy/providers/Microsoft.Compute/snapshots/s1?api-version=2020-05-01 HTTP/1.1" 404 92
azure.core.pipeline.policies._universal: Response status: 404
azure.core.pipeline.policies._universal: Response headers:
azure.core.pipeline.policies._universal:     'Cache-Control': 'no-cache'
azure.core.pipeline.policies._universal:     'Pragma': 'no-cache'
azure.core.pipeline.policies._universal:     'Content-Length': '92'
azure.core.pipeline.policies._universal:     'Content-Type': 'application/json; charset=utf-8'
azure.core.pipeline.policies._universal:     'Expires': '-1'
azure.core.pipeline.policies._universal:     'x-ms-ratelimit-remaining-resource': 'Microsoft.Compute/HighCostSnapshotCreateHydrate3Min;999,Microsoft.Compute/HighCostSnapshotCreateHydrate30Min;7996'
azure.core.pipeline.policies._universal:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
azure.core.pipeline.policies._universal:     'x-ms-served-by': '42128af7-4c72-4222-9761-fb0d8e6cebdc_132528232982895561'
azure.core.pipeline.policies._universal:     'x-ms-request-id': 'bc86e697-dccb-440a-97b6-a40685274850'
azure.core.pipeline.policies._universal:     'Server': 'Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0'
azure.core.pipeline.policies._universal:     'x-ms-ratelimit-remaining-subscription-writes': '1194'
azure.core.pipeline.policies._universal:     'x-ms-correlation-request-id': '15edd3e4-78a3-41ef-8881-cdc3dfd0d32e'
azure.core.pipeline.policies._universal:     'x-ms-routing-request-id': 'SOUTHEASTASIA:20210127T085914Z:15edd3e4-78a3-41ef-8881-cdc3dfd0d32e'
azure.core.pipeline.policies._universal:     'X-Content-Type-Options': 'nosniff'
azure.core.pipeline.policies._universal:     'Date': 'Wed, 27 Jan 2021 08:59:14 GMT'
azure.core.pipeline.policies._universal: Response content:
azure.core.pipeline.policies._universal: {
  "error": {
    "code": "NotFound",
    "message": "Resource d1 is not found."
  }
}

qwordy avatar Jan 27 '21 09:01 qwordy

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @avirishuv, @vaibhav-agar, @amjads1.

Issue Details

[Enter feedback here]


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

  • ID: fca6f8c5-a518-04ee-08e3-4ad8d4c9516e
  • Version Independent ID: 17710c8c-9cd9-57ea-b6b0-1411648ea03f
  • Content: az snapshot
  • Content Source: latest/docs-ref-autogen/snapshot.yml
  • Service: virtual-machines
  • GitHub Login: @rloutlaw
  • Microsoft Alias: routlaw
Author: vnextcoder
Assignees: qwordy
Labels:

Compute, Service Attention, question

Milestone: -

ghost avatar Jan 27 '21 09:01 ghost

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @avirishuv, @Vaibhav-Agar, @amjads1. Issue Details

Hi guys, can you help take a look? Thanks!

qwordy avatar Jan 27 '21 09:01 qwordy

Looking into the issue

amjads1 avatar Jan 27 '21 20:01 amjads1

@Vaibhav-Agar Can you please look into this issue?

amjads1 avatar Jan 29 '21 18:01 amjads1

The problem is that snapshot does not support creating from a disk from a different location. But, the error message is misleading. It says "Resource d1 is not found".

qwordy avatar Feb 01 '21 03:02 qwordy

Hi @qwordy, You are correct. I was able to replicate the issue by using a different location for the source and snapshot. I have submitted this to the dev team now to fix.

Vaibhav-Agar avatar Feb 04 '21 21:02 Vaibhav-Agar

This is in the backlog but doesn't have an ETA right now.

Vaibhav-Agar avatar Mar 25 '21 20:03 Vaibhav-Agar

Still no ETA.

Vaibhav-Agar avatar Jun 03 '21 15:06 Vaibhav-Agar

Hello @vnextcoder It looks like this issue was miscatagorized earlier. The behavior is actually by design for the following reason: The resource provider for microsoft.compute is a unique service in each region. In the above scenario no region is provided so Azure Resource Manager will send the create snapshot PUT request to the compute RP in the region of the resource group. In this example the resource group appears to be in region X, but the disk is in region Y. So from the perspective of the service in region X there is no disk with the name specified. This leads to a not found error being properly returned. Hope this helps explain what you are seeing.

oriwolman avatar Sep 30 '21 15:09 oriwolman

Closing issue, please reopen if needed

oriwolman avatar Oct 08 '21 23:10 oriwolman