question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting lock for specified resource with az lock show --resource xxx fails with exception

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az lock show

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 233, 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 363, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/arm.py", line 429, in show_exception_handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 361, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/custom.py", line 3125, in get_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 1355, in get_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 381, in build_management_locks_get_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:

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

  • Put any pre-requisite steps here…
  • az lock show --resource {}

Expected Behavior

Environment Summary

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

azure-cli 2.40.0

Extensions:
quota 0.1.0

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

Additional Context

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
zhoxing-mscommented, Nov 4, 2022

@Fireblade954 This problem is actually caused by a mistake in usage. Please distinguish the --resource parameter from --name parameter

(env) PS C:\Users\xxx\project> az lock show -h

Command
    az lock show : Show the properties of a lock.

Arguments
    ......
    --name -n                  : Name of the lock.
    ......
    --resource --resource-name : Name or ID of the resource being locked. If an ID is given, other
                                 resource arguments should not be given.

As we can see in the help message, the --resource parameter needs to pass in the ID of the resource being locked, while the --name parameter needs to pass in the lock name. Therefore, the --resource parameter should NOT be passed in the lock ID. The correct usage should be: az lock show --resource {locked_resouce_id} --name {lock_name}

0reactions
navba-MSFTcommented, Nov 7, 2022

@Fireblade954 The action is currently pending on you to try the action plan mentioned above. Please feel free to reopen this thread if you need any further assistance on this in future. We would be happy to help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Service Bus - messaging exceptions
The MessageLockLostException is thrown when a message is received using the PeekLock Receive mode and the lock held by the client expires on...
Read more >
Transaction (Process ID xxx) was deadlocked on lock ...
error message: Transaction (Process ID 237) was deadlocked on lock resources with another process and has been chosen as the deadlock victim.
Read more >
Azure Java SDK - Can't add resource locks
According to the error message, you do not have enough permissions to create resource locks. In fact, to create or delete management locks, ......
Read more >
Safari Technology Preview Release Notes
Fixed an issue where browser.tabs sometimes returned an incorrect URL for pinned tabs. Bug Fixes. Fixed the Share Menu when sharing an image...
Read more >
Error Messages
NOTE: when a command is locked, this does not automatically imply that subcommands ... breakpoint resource on the debug hardware, e.g. if the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found