Azure / Azure/azure-cli

'az resource tag' doesn’t work with snapshots from images with legal terms

Aperta
#17,246 1 commento 0 reazioni 1 assegnatario Rivendicata da @zhoxing-ms Vedi su GitHub
act-identity-squad ARM feature-request
Lingua principale
Python
Stelle
4.6k
Fork
3.5k
Merge medio
3g 18h
PR unite (30g)
62

Descrizione

## Describe the bug

**Command Name**
`az resource tag`

**Errors:**

```text
This subscription is not registered to use Microsoft.Compute/TestSubscription feature.
```

## To Reproduce

- Create resource group: `az group create --location westeurope --resource-group 'rg-kali'`
- Attempt to create Kali Linux virtual machine:

```console
$ az vm create \
--name 'vm-kali' \
--resource-group 'rg-kali' \
--admin-username 'test-user' \
--image 'kali-linux:kali-linux:kali:2019.2.0' \
--ssh-key-values @~/.ssh/id_rsa.pub

Azure Error: MarketplacePurchaseEligibilityFailed
Message: Marketplace purchase eligibilty check returned errors. See inner errors for details.
Exception Details:
Error Code: BadRequest
Message: Offer with PublisherId: 'kali-linux', OfferId: 'kali-linux' cannot be purchased due to validation errors.

```

- Agree to terms:

```console
$ az vm image terms accept --offer 'kali-linux' --plan 'kali' --publisher 'kali-linux'
{
"accepted": true,

}
```

- Create Kali Linux VM:

```console
$ az vm create \
--name 'vm-kali' \
--resource-group 'rg-kali' \
--admin-username 'test-user' \
--image 'kali-linux:kali-linux:kali:2019.2.0' \
--ssh-key-values @~/.ssh/id_rsa.pub

{- Finished ..

}
```

- Stop VM:

```console
$ az vm stop --name 'vm-kali' --resource-group 'rg-kali'
About to power off the specified VM...
It will continue to be billed. To deallocate a VM, run: az vm deallocate.
```

- Get VM disk's managed ID:

```console
$ az vm show \
--name 'vm-kali' \
--resource-group 'rg-kali' \
--query 'storageProfile.osDisk.managedDisk.id' --out tsv

```

- Create snapshot from VM disk without initial tags:

```console
$ az snapshot create --name 'snp-kali' --resource-group 'rg-kali' --source
{- Finished ..

}
```

- Attempt to tag snapshot using `az resource tag`:

```console
$ az resource tag \
--tags my-tag=my-value \
--resource-group 'rg-kali' \
--name 'snp-kali' \
--resource-type 'Microsoft.Compute/snapshots'

This subscription is not registered to use Microsoft.Compute/TestSubscription feature.
```

## Expected Behavior

For:

- the command to succeed, or;
- the error message to be more descriptive if for some reason the command cannot be fixed to succeed.

## Environment Summary

```text
Linux-5.10.19-200.fc33.x86_64-x86_64-with-glibc2.32
Python 3.9.2
Installer: RPM

azure-cli 2.20.0
```

## Additional Context

Found the following related to this:

- if one creates an image (`Microsoft.Compute/images`) instead of a snapshot (`Microsoft.Compute/snapshots`), then tagging with `az resource tag` **will succeed**;
- using `az tag create` to tag, regardless of the type of resource, **will succeed**

I have not tested other images from the Azure Marketplace that have legal terms attached to them.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.