Azure / Azure/azure-cli

az lock delete Unexpected --namespace for lock XXX, expected microsoft.storage (got Microsoft.Storage) worked before

Open
#20,351 4 comments 2 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-identity-squad ARM customer-reported feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug
az lock delete --name AzureBackupProtectionLock --resource-group rsg-hklife-prd-az2-ZZZ --resource MMMM --resource-type Microsoft.Storage/storageAccounts
ERROR: Unexpected --namespace for lock AzureBackupProtectionLock, expected microsoft.storage

resource type from az cli
```
+ az storage account list
"keySource": "Microsoft.Storage",
"id": "/subscriptions/XXX/resourceGroups/XXX/providers/Microsoft.Storage/storageAccounts/YYY",
"type": "Microsoft.Storage/storageAccounts"
"keySource": "Microsoft.Storage",
```

**Command Name**
`az lock delete`

**Errors:**
```
Unexpected --namespace for lock AzureBackupProtectionLock, expected microsoft.storage
```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- Run command above with "Microsoft.Storage"

## Expected Behavior
Worked both ways.

## Environment Summary
```
Linux-4.15.0-1113-azure-x86_64-with-debian-9.13
Python 3.6.10
Installer: DEB

azure-cli 2.21.0

Extensions:
account 0.2.1

```
## Additional Context

Another storage account lock was processed successfully with "Microsoft.Storage" value

```
+ az lock delete --name AzureBackupProtectionLock --resource-group rsg-hklife-prd-az1-XXX--resource ZZZ --resource-type Microsoft.Storage/storageAccounts
[Pipeline] sh
+ az lock delete --name AzureBackupProtectionLock --resource-group rsg-hklife-prd-az2-XXX --resource ZZZ --resource-type Microsoft.Storage/storageAccounts
ERROR: Unexpected --namespace for lock AzureBackupProtectionLock, expected microsoft.storage
```

The error message ` Unexpected --namespace` is also confusing, no --namespace argument was given (it was parsed from resource-type and/or resource-name/ -id). I'd recommend changing the error outputs here.

MS Staff - contact me if you need a real tenant/subscription and resource Id(s)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.