In this Azure PowerShell article, we will discuss the syntax and usage of the Set-AzResourceLock Azure PowerShell cmdlet and we will also discuss how to use the Set-AzResourceLock command with examples.
Table of Contents
Set-AzResourceLock
This is a very good command to modify a resource lock in a second. Let’s see the syntax of this PowerShell command.
Syntax
Below is the syntax of the Set-AzResourceLock Azure PowerShell cmdlet.
Set-AzResourceLock
-LockName <String>
-LockLevel <LockLevel>
Set-AzResourceLock
-LockName <String>
-LockLevel <LockLevel>
[-LockNotes <String>] -ResourceGroupName <String>
-ResourceName <String>
-ResourceType <String>
Well, let’s discuss how to use the Set-AzResourceLock command with an example.
Example
Execute the below PowerShell cmdlet that will help you to modify the Lock notes value of TsInfoWebSiteLock from “tsinfo lock detail notes” to “tsinfo lock detail notes- Latest”.
Set-AzResourceLock -LockLevel CanNotDelete -LockName "TsInfoWebSiteLock" -LockNotes "tsinfo lock detail notes- Latest" -ResourceName "TsInfoweb" -ResourceType "microsoft.web/sites" -ResourceGroupName "MyNewResGrp"
After executing the above script, It prompted me to confirm the updation process so clicked on the Yes button on the below pop-up.

Then the note got updated successfully and I got the below output.
Name : TsInfoWebSiteLock
ResourceId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGr
oups/MyNewResGrp/providers/microsoft.web/sites/TsInfoweb/provi
ders/Microsoft.Authorization/locks/TsInfoWebSiteLock
ResourceName : TsInfoweb
ResourceType : microsoft.web/sites
ExtensionResourceName : TsInfoWebSiteLock
ExtensionResourceType : Microsoft.Authorization/locks
ResourceGroupName : MyNewResGrp
SubscriptionId : 1cdf4300-dee5-4518-9c9c-feaa72a5cbd1
Properties : @{level=CanNotDelete; notes=tsinfo lock detail notes- Latest}
LockId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGr
oups/MyNewResGrp/providers/microsoft.web/sites/TsInfoweb/provi
ders/Microsoft.Authorization/locks/TsInfoWebSiteLock
You can see the same output below

You may also like following the below articles
Wrapping Up
In this Azure article, we discussed the syntax and usage of the Set-AzResourceLock PowerShell command with examples. Thanks for reading this article !!!