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.

Resource Lock - impossible to work with

See original GitHub issue

Command Name az resource lock list

Errors:

Missing required resource_name parameter.

Expected Behavior

Be able to list resource locks

Environment Summary

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

azure-cli 2.39.0

Extensions:
account 0.2.3
managementpartner 0.1.3

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

Additional Context

Some tries:

❯ az resource lock list --resource /subscriptions/da0efdd1-xxx/resourceGroups/UC-xxx -g UC-xxx      
--resource-type is required if the name, --resource, is present
az resource lock list --resource /subscriptions/da0efdd1xxx/resourceGroups/UC-xxx -g UC-xxx --resource-type Microsoft.Resources/subscriptions/resourceGroups
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 710, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/core/paging.py", line 129, in __next__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/core/paging.py", line 76, in __next__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py", line 1731, in get_next
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py", line 1693, in prepare_request    
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py", line 564, in build_management_locks_list_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
❯ az resource lock list --resource /subscriptions/da0efdd1-xxx/resourceGroups/UC-xxx -g UC-xxx      
--resource-type is required if the name, --resource, is present
❯ az resource lock list --resource "/subscriptions/da0efdd1-xxx/resourceGroups/UC-xxx"
'NoneType' object has no attribute 'strip'

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lkurzyniec-bcgcommented, Sep 4, 2022

az group lock solves the problem. thx!

1reaction
zhoxing-mscommented, Sep 3, 2022

@ynden Thanks for your kind reply!

@lkurzyniec-bcg Please note that there are two command groups with different scopes. If you want to operate the lock of resource group level, please use az group lock

> (env) PS C:\Users\zhoxing.FAREAST\Desktop\project> az group lock -h

Group
    az group lock : Manage Azure resource group locks.

If you want to operate the lock of resource level, please use az resource lock

> (env) PS C:\Users\zhoxing.FAREAST\Desktop\project> az resource lock -h

Group
    az resource lock : Manage Azure resource level locks.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Protect your Azure resources with a lock - Microsoft Learn
You can safeguard Azure resources from updates or deletions by locking all users and roles.
Read more >
How do you fix a TeamCity shared resource lock after a hard ...
Now it appears that write lock never got released. None of the builds that use that shared resource can run--they all just queue...
Read more >
Reading 23: Locks and Synchronization - MIT
Because the use of locks requires threads to wait ( acquire blocks when another thread is holding the lock), it's possible to get...
Read more >
8.2 How are Resources Locked During Jobs?
8.2 How are Resources Locked During Jobs? · By logging out the user who initiated the lock. · By direct action of an...
Read more >
Azure Resource Locks the What Why - Jack Tracey
As the names suggest, CanNotDelete means the resources with the lock applied can be read and modified, but they cannot be deleted. 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