Skip to content

az lock create , On sql database causes error #23218

@Maashkinoozhe

Description

@Maashkinoozhe

Describe the bug

I tried to create a cannotdeletelock on an sql database.

It works with Powershell New-AzResourceLock but not with azure cli.

Command Name
az lock create

Errors:

The command failed with an unexpected error. Here is the traceback:
No value for given attribute
Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/custom.py", line 3231, in create_lock
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/core/tracing/decorator.py", line 73, in wrapper_use_tracer
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py", line 1198, in create_or_update_at_resource_level
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py", line 291, in build_management_locks_create_or_update_at_resource_level_request
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msrest/serialization.py", line 652, in url
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msrest/serialization.py", line 760, in serialize_data
ValueError: No value for given attribute

To Reproduce:

Use this command with an existing sql database.

  • Put any pre-requisite steps here...
  • az lock create --name <lockName> --resource-group <rgName> --lock-type CanNotDelete --resource <servername>/<dbname> --resource-type Microsoft.Sql/servers/databases

Expected Behavior

Creates a lock on the sql db

Environment Summary

Windows-10-10.0.19044-SP0
Python 3.10.5
Installer: MSI

azure-cli 2.38.0

Extensions:
azure-devops 0.25.0

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

Metadata

Metadata

Assignees

Labels

ARMaz resource/group/lock/tag/deployment/policy/managementapp/account management-groupAuto-AssignAuto assign by botService AttentionThis issue is responsible by Azure service team.act-identity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions