az snapshot create: failed in cmdline but succeeded in Portal GUI
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 64
Description
## Describe the bug
Create a snapshot of existing Azure disk. Failed when running `az snapshot create` at the command line. However the snapshot can be created manually using Azure portal UI.
**Command Name**
`az snapshot create`
**Errors:**
```
(OperationNotAllowed) CopyStart creation is not supported for this subscription.
Code: OperationNotAllowed
Message: CopyStart creation is not supported for this subscription.
```
## To Reproduce:
Create a snapshot from an existing Azure disk. You need to know the azure disk Id to initialize the `DEMO_PV_AZ_DISKID` variable. In my case this is the name of the Kubernete Persistent Volume whcih is provisioned by the azure disk. In the example below that PV name is `my-kubernetes-pv-name`
```
DEMO_PV_AZ_DISKID=$(az disk list --subscription $AZ_SUBSCRIPTION --resource-group $AZ_RSGROUP \
--query "[?contains(@.id, 'my-kubernetes-pv-name')==\`true\`].id" -o tsv)
# example of value
DEMO_PV_AZ_DISKID='/subscriptions/71d79434-..etc..-49c86f13b3c5/resourceGroups/my-aks-resourcegroup/providers/Microsoft.Compute/disks/kubernetes-dynamic-pvc-a7642a85-..etc..-852dd015fc08'
```
Then create a snapshot ... which fails by "(OperationNotAllowed) CopyStart creation is not supported for this subscription."
```
AZ_SUBSCRIPTION='my-subscription'
AZ_RSGROUP='my-aks-resourcegroup'
az snapshot create --subscription $AZ_SUBSCRIPTION --resource-group $AZ_RSGROUP \
--name demoPVmigrationSnapshot \
--source $DEMO_PV_AZ_DISKID
```
## Expected Behavior
Should create the snapshot and output the snapshot summary info similar to when doing "Create snapshot" using the Azure portal UI:

## Environment Summary
```
Linux-5.11.0-27-generic-x86_64-with-debian-bullseye-sid, Ubuntu 20.04.3 LTS
Python 3.6.10
Installer: DEB
azure-cli 2.30.0
```
## Additional Context
Contributor guide
Assessment
This issue has not been assessed yet.