In this Azure PowerShell article, we will discuss the syntax and usage of the Get-AzResourceLock Azure PowerShell cmdlet with examples.
Table of Contents
Get-AzResourceLock
Get-AzResourceLock is a very good Azure PowerShell cmdlet that can help you to retrieve the Azure resource locks.
Syntax of Get-AzResourceLock
Below is the syntax of Get-AzResourceLock Azure PowerShell cmdlet.
Get-AzResourceLock
Get-AzResourceLock
[-LockName <String>]
[-AtScope]
-ResourceGroupName <String>
[-ApiVersion <String>]
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
Example:
Execute the below Azure PowerShell cmdlet that can help you to get the Azure resource locks.
Get-AzResourceLock
Once, I have executed the above Azure PowerShell cmdlet, I got the below output
PS C:\Users\Bijay> Get-AzResourceLock
Name : NoDelete
ResourceId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups
/myRsgGroup/providers/Microsoft.Authorization/locks/NoDelete
ResourceName : NoDelete
ResourceType : Microsoft.Authorization/locks
ResourceGroupName : myRsgGroup
SubscriptionId : 1cdf4300-dee5-4518-8c8c-feaa72a5hjk1
Properties : @{level=ReadOnly; notes=Don't delete it's critical}
LockId : /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5hjk1/resourceGroups
/myRsgGroup/providers/Microsoft.Authorization/locks/NoDelete
Name : Nodelete
ResourceId : /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5hjk1/resourceGroups
/TsinfoNew_group/providers/Microsoft.Authorization/locks/Nodelete
ResourceName : Nodelete
ResourceType : Microsoft.Authorization/locks
ResourceGroupName : TsinfoNew_group
SubscriptionId : 1cdf4300-dee5-4518-8c8c-feaa72a5hjk1
Properties : @{level=ReadOnly; notes=ff}
LockId : /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5hjk1/resourceGroups
/TsinfoNew_group/providers/Microsoft.Authorization/locks/Nodelete
Check out the output here

Example-2:
You can also execute the below Azure PowerShell cmdlet to get a specific lock by its name.
Get-AzResourceLock -LockName "TsinfoLock" -ResourceName "TsInfoSite" -ResourceType "microsoft.web/sites" -ResourceGroupName "TsinfoNew_group"
Example-3:
You can also use the below Azure PowerShell cmdlet to retrieve the Lock from a specific Resource Group scope.
Get-AzResourceLock -ResourceGroupName "TsinfoNew_group" -AtScope
After executing the above command, I got the below output
PS C:\Users\Bijay> Get-AzResourceLock -ResourceGroupName "TsinfoNew_group" -AtScope
Name : Nodelete
ResourceId : /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5hjk1/resourceGroups
/TsinfoNew_group/providers/Microsoft.Authorization/locks/Nodelete
ResourceName : Nodelete
ResourceType : Microsoft.Authorization/locks
ResourceGroupName : TsinfoNew_group
SubscriptionId : 1cdf4300-dee5-4518-8c8c-feaa72a5hjk1
Properties : @{level=ReadOnly; notes=ff}
LockId : /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5hjk1/resourceGroups
/TsinfoNew_group/providers/Microsoft.Authorization/locks/Nodelete
You may also like following the below articles
Wrapping Up
In this Azure PowerShell article, we will discuss the syntax and usage of the Get-AzResourceLock Azure PowerShell cmdlet. Thanks for reading this article !!!

I am Rajkishore, and I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machine, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.