Hello Sushil
I understand you're trying to delete the NSG rule but can't because a Lock is set on your resource group. You tried two different methods your first attempt didn't work, but the second one was successful even though the lock was applied at the RG level.
I also tested both methods in my lab environment, but I couldn't delete the rule when a Lock was applied at the resource group level. Check the below screen shots.
I clicked the delete option directly, but the operation failed. Please see the screenshot.
Selecting the checkbox, after clicking the top delete option did not work.
After changing the resource lock option to 'delete', I tried the first method, but it didn't work for deleting the rule. However, the rule was successfully deleted using the second method. Check the screen shots. Direct deletion isn't working; it's prompting for confirmation before deleting. This issue might be related to the way the deletion is being performed. It’s a good idea to review the deletion method and confirm that it uses the Azure Resource Manager (ARM) control plane, rather than any data plane operations, since only the control plane is affected by locks.
From my understanding, if you set the lock type to read-only, you won't be able to perform any actions at the resource group level. If you use a delete lock, you can still delete rules at the resource level, but you won't be able to delete the resource itself. Additionally, implementing any new rule is still possible.
Hope the above answer helps! Please let us know do you have any further queries.
Please do not forget to "up-vote” wherever the information provided helps you, this can be beneficial to other community members.