{"id":16985,"date":"2020-08-19T12:42:17","date_gmt":"2020-08-19T12:42:17","guid":{"rendered":"https:\/\/www.testpreptraining.com\/tutorial\/?page_id=16985"},"modified":"2022-03-14T11:33:55","modified_gmt":"2022-03-14T11:33:55","slug":"creating-azure-resource-locks","status":"publish","type":"page","link":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/","title":{"rendered":"Creating Azure Resource Locks"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-500-microsoft-azure-security-technologies\/\" target=\"_blank\" rel=\"noreferrer noopener\">Go back to AZ-500 Tutorials<\/a><\/p>\n\n\n\n<p>In this tutorial, we will learn and understand about creating and managing Azure Resource locks.<\/p>\n\n\n\n<p>However, you may require to lock a subscription, resource group, or resource for preventing other users as an administrator. For this, you can set the lock level to CanNotDelete or ReadOnly. Here, CanNotDelete means authorized users can still read and modify a resource, but they can&#8217;t delete the resource. Whereas, ReadOnly means authorized users can read a resource, but they can&#8217;t delete or update the resource. Applying this lock is similar to restricting all authorized users to the permissions granted by the Reader role.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Applying locks<\/strong><\/h4>\n\n\n\n<p>When you apply a lock to a parent scope, it applies to all resources within that scope. Furthermore, any resources you add subsequently will inherit the parent&#8217;s lock. Unlike role-based access control, you use management locks to apply a restriction to all users and roles.<\/p>\n\n\n\n<p>Resource Manager locks, on the other hand, only apply to activities that take place on the management plane, such as those submitted to https:\/\/management.azure.com. The locks prevent resources from performing their own tasks.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>Considerations before applying locks<\/strong><\/h6>\n\n\n\n<p>Locks can have unanticipated consequences since certain procedures that don&#8217;t appear to affect the resource nonetheless need actions that the lock prevents. The following are some instances of procedures that are hindered by locks:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Firstly, a read-only lock on a storage account prevents all users from listing the keys.&nbsp;<\/li><li>Secondly, a read-only lock on an App Service resource prevents Visual Studio Server Explorer from displaying files for the resource because that interaction requires to write access.<\/li><li>Thirdly, a read-only lock on a resource group that contains a virtual machine prevents all users from starting or restarting the virtual machine.&nbsp;<\/li><li>Fourthly, a cannot-delete lock on a resource group prevents Azure Resource Manager from automatically deleting deployments in the history. Moreover, a cannot-delete lock on the resource group created by Azure Backup Service causes backups to fail.&nbsp;<\/li><\/ul>\n\n\n\n<p><em>You should know that for creating or deleting management locks, you must have access to Microsoft.Authorization\/* or Microsoft.Authorization\/locks\/* actions.&nbsp;<\/em><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.testpreptraining.ai\/microsoft-azure-security-technologies-az-500-free-practice-test\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" width=\"961\" height=\"150\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ_500-practice-tests-9.png\" alt=\"AZ-500 practice tests\" class=\"wp-image-17926\" srcset=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ_500-practice-tests-9.png 961w, https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ_500-practice-tests-9-750x117.png 750w\" sizes=\"auto, (max-width: 961px) 100vw, 961px\" \/><\/a><\/figure><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Managed Applications and locks<\/strong><\/h4>\n\n\n\n<p>Managed apps are used to implement some Azure services, such as Azure Databricks. One resource group, however, is unlocked and gives an overview of the service. The infrastructure for the locked service is included in the other resource group.<\/p>\n\n\n\n<p>When you try to remove the infrastructure resource group, however, you get an error message claiming that it is locked. When you try to delete the lock for the infrastructure resource group, you get an error that says it can&#8217;t be done since it&#8217;s held by a system application.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Portal<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>Firstly, in the Settings blade for the resource, resource group, or subscription that you wish to lock, select Locks.<\/li><li>Secondly, to add a lock, select Add. However, if you want to create a lock at a parent level, then select the parent.&nbsp;<\/li><li>Thirdly, give the lock a name and lock level.&nbsp;<\/li><li>Lastly, for deleting the lock, select the ellipsis and Delete from the available options.<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Template<\/strong><\/h4>\n\n\n\n<p>When deploying a lock using a Resource Manager template, you use various values for the name and type depending on the lock&#8217;s scope.<\/p>\n\n\n\n<p>Use the following formats when applying a lock to a resource:&nbsp;<\/p>\n\n\n\n<p>name &#8211; {resourceName}\/Microsoft.Authorization\/{lockName}<\/p>\n\n\n\n<p>type &#8211; {resourceProviderNamespace}\/{resourceType}\/providers\/locks<\/p>\n\n\n\n<p>Use the format below when applying a lock to a resource group or subscription:<\/p>\n\n\n\n<p>name &#8211; {lockName}<\/p>\n\n\n\n<p>type &#8211; Microsoft.Authorization\/locks<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>PowerShell<\/strong><\/h4>\n\n\n\n<p>Using the New-AzResourceLock command in Azure PowerShell, you can now lock deploying resources.<\/p>\n\n\n\n<p>Provide the resource&#8217;s name, resource type, and resource group name when locking a resource.<\/p>\n\n\n\n<p><strong>Azure PowerShell<\/strong><\/p>\n\n\n\n<p><em>New-AzResourceLock -LockLevel CanNotDelete -LockName LockSite -ResourceName examplesite -ResourceType Microsoft.Web\/sites -ResourceGroupName exampleresourcegroup<\/em><\/p>\n\n\n\n<p>Provide the resource group&#8217;s name to lock the resource group.<\/p>\n\n\n\n<p><strong>Azure PowerShell<\/strong><\/p>\n\n\n\n<p><em>New-AzResourceLock -LockName LockGroup -LockLevel CanNotDelete -ResourceGroupName exampleresourcegroup<\/em><\/p>\n\n\n\n<p>For getting information about a lock, use Get-AzResourceLock. And, to get all the locks in your subscription, use:<\/p>\n\n\n\n<p><strong>Azure PowerShell<\/strong><\/p>\n\n\n\n<p><em>Get-AzResourceLock<\/em><\/p>\n\n\n\n<p>For getting all locks for a resource, use:<\/p>\n\n\n\n<p><strong>Azure PowerShell<\/strong><\/p>\n\n\n\n<p><em>Get-AzResourceLock -ResourceName examplesite -ResourceType Microsoft.Web\/sites -ResourceGroupName exampleresourcegroup<\/em><\/p>\n\n\n\n<p>For getting all locks for a resource group, use:<\/p>\n\n\n\n<p><strong>Azure PowerShell<\/strong><\/p>\n\n\n\n<p><em>Get-AzResourceLock -ResourceGroupName exampleresourcegroup<\/em><\/p>\n\n\n\n<p>For deleting a lock, use:<\/p>\n\n\n\n<p><strong>Azure PowerShell<\/strong><\/p>\n\n\n\n<p><em>$lockId = (Get-AzResourceLock -ResourceGroupName exampleresourcegroup -ResourceName examplesite -ResourceType Microsoft.Web\/sites).LockId<\/em><\/p>\n\n\n\n<p><em>Remove-AzResourceLock -LockId $lockId<\/em><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.testpreptraining.ai\/microsoft-azure-security-technologies-az-500-practice-exam\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" width=\"961\" height=\"150\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ-500-online-course-10.png\" alt=\"Az-500 online course Azure resource locks concept\" class=\"wp-image-16993\" srcset=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ-500-online-course-10.png 961w, https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ-500-online-course-10-750x117.png 750w\" sizes=\"auto, (max-width: 961px) 100vw, 961px\" \/><\/a><\/figure><\/div>\n\n\n\n<p class=\"has-text-align-right\"><strong>Reference: <\/strong><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/azure-resource-manager\/management\/lock-resources\" target=\"_blank\" rel=\"noreferrer noopener\">Microsoft Documentation<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-500-microsoft-azure-security-technologies\/\" target=\"_blank\" rel=\"noreferrer noopener\"><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-500-microsoft-azure-security-technologies\/\" target=\"_blank\" rel=\"noreferrer noopener\">Go back to AZ-500 Tutorials<\/a><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go back to AZ-500 Tutorials In this tutorial, we will learn and understand about creating and managing Azure Resource locks. However, you may require to lock a subscription, resource group, or resource for preventing other users as an administrator. For this, you can set the lock level to CanNotDelete or ReadOnly. Here, CanNotDelete means authorized&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-16985","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Creating Azure Resource Locks | Microsoft Azure AZ-500 Tutorials<\/title>\n<meta name=\"description\" content=\"Enhance your skills by learning about creating Azure resource locks using Microsoft AZ-500 online course and Practice Exam Now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating Azure Resource Locks | Microsoft Azure AZ-500 Tutorials\" \/>\n<meta property=\"og:description\" content=\"Enhance your skills by learning about creating Azure resource locks using Microsoft AZ-500 online course and Practice Exam Now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/\" \/>\n<meta property=\"og:site_name\" content=\"Testprep Training Tutorials\" \/>\n<meta property=\"article:modified_time\" content=\"2022-03-14T11:33:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ_500-practice-tests-9.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/\",\"name\":\"Creating Azure Resource Locks | Microsoft Azure AZ-500 Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\"},\"datePublished\":\"2020-08-19T12:42:17+00:00\",\"dateModified\":\"2022-03-14T11:33:55+00:00\",\"description\":\"Enhance your skills by learning about creating Azure resource locks using Microsoft AZ-500 online course and Practice Exam Now!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating Azure Resource Locks\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"name\":\"Testprep Training Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\",\"name\":\"Testprep Training\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"contentUrl\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"width\":583,\"height\":153,\"caption\":\"Testprep Training\"},\"image\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating Azure Resource Locks | Microsoft Azure AZ-500 Tutorials","description":"Enhance your skills by learning about creating Azure resource locks using Microsoft AZ-500 online course and Practice Exam Now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/","og_locale":"en_US","og_type":"article","og_title":"Creating Azure Resource Locks | Microsoft Azure AZ-500 Tutorials","og_description":"Enhance your skills by learning about creating Azure resource locks using Microsoft AZ-500 online course and Practice Exam Now!","og_url":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/","og_site_name":"Testprep Training Tutorials","article_modified_time":"2022-03-14T11:33:55+00:00","og_image":[{"url":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/08\/AZ_500-practice-tests-9.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/","url":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/","name":"Creating Azure Resource Locks | Microsoft Azure AZ-500 Tutorials","isPartOf":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website"},"datePublished":"2020-08-19T12:42:17+00:00","dateModified":"2022-03-14T11:33:55+00:00","description":"Enhance your skills by learning about creating Azure resource locks using Microsoft AZ-500 online course and Practice Exam Now!","breadcrumb":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-azure-resource-locks\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.testpreptraining.ai\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Creating Azure Resource Locks"}]},{"@type":"WebSite","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","name":"Testprep Training Tutorials","description":"","publisher":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization","name":"Testprep Training","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","contentUrl":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","width":583,"height":153,"caption":"Testprep Training"},"image":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/16985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/comments?post=16985"}],"version-history":[{"count":5,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/16985\/revisions"}],"predecessor-version":[{"id":52832,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/16985\/revisions\/52832"}],"wp:attachment":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/media?parent=16985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/categories?post=16985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/tags?post=16985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}