Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124

In enterprise cloud environments, accidental deletion or modification of critical Azure resources can lead to catastrophic outages, data loss, and compliance violations. Microsoft Azure addresses this risk through a built-in governance feature called Resource Locks.
Azure Resource Locks are governance controls that can be placed at the subscription, resource group, or individual resource level. They prevent unauthorized or unintended modifications to Azure resources โ independent of the Azure Role-Based Access Control (RBAC) permissions a user holds.
Key Insight for AZ-104 Exam: Resource Locks override RBAC permissions. Even if a user has Owner-level access, a lock will prevent them from deleting or modifying a resource unless the lock itself is removed first. This is a critical distinction tested in the AZ-104 exam.
๐ก
Real-world Use Case: In your AZ104-Governance-RG resource group, applying a CanNotDelete lock on a Production Virtual Network ensures that no team member โ regardless of their RBAC role โ can accidentally delete it during a maintenance window.
Azure provides two types of resource locks, each offering a different level of protection based on your governance requirements.
๐ด
Users can read and modify the resource, but cannot delete it. This is the most commonly used lock type in production environments.
High Protection
๐ก
Users can only read the resource. No modifications, updates, or deletions are permitted. Equivalent to applying Reader RBAC role.
Maximum Restriction
โ ๏ธ
ReadOnly on Storage Accounts: Applying a ReadOnly lock to a Storage Account will prevent listing storage keys โ since listing keys is classified as a POST action, not a GET. This can break applications that rely on key-based access. Plan carefully before applying ReadOnly locks to storage resources.
Section 03 โ Scope & Inheritance
One of the most important concepts for the AZ-104 exam and real-world usage is how lock inheritance works across the Azure resource hierarchy.
| Lock Applied At | Subscription Protected | Resource Group Protected | Individual Resource Protected |
|---|---|---|---|
| Subscription Level | โ Yes | โ Yes (inherited) | โ Yes (inherited) |
| Resource Group Level | โ No | โ Yes | โ Yes (inherited) |
| Resource Level | โ No | โ No | โ Yes |
In your AZ104-Governance-RG, if you apply a lock at the resource group level, all child resources (VMs, Storage Accounts, VNets, NSGs, etc.) will inherit that lock automatically โ you do not need to apply it individually to each resource.
Azure Resource Movement is the capability to move resources from one resource group to another, or from one subscription to another, without losing any configuration, data, or existing connections โ in most cases.
Moving resources is essential for scenarios like organizational restructuring, subscription consolidation, environment promotion (Dev โ Prod), and cost management.
SCENARIO 01
Move resources from AZ104-Governance-RG to another resource group within the same subscription.
SCENARIO 02
Transfer resources to a different Azure subscription โ both subscriptions must be in the same Azure AD tenant.
SCENARIO 03
Use Azure Resource Mover to relocate resources to a different Azure region โ this is a separate service with a different workflow.
Section 05 โ Prerequisites & Limitations
| Resource Type | Can Move Same Sub | Can Move Cross-Sub |
|---|---|---|
| Azure AD Domain Services | โ | โ |
| Recovery Services Vault (with data) | โ | โ |
| Azure Kubernetes Service (AKS) | โ | โ |
| Virtual Machines (Classic) | โ | โ |
| App Service Certificates | โ | โ |
| Virtual Machines (ARM, no ext.) | โ | โ |
| Storage Accounts | โ | โ |
To move resources, the user account must have the following permissions on both the source and destination resource groups:
๐
Lock Impact on Movement: A CanNotDelete lock does NOT block resource movement. However, a ReadOnly lock WILL block movement because movement is a write operation on the resource group. Always remove ReadOnly locks before attempting a resource move.
In this lab, we will work inside AZ104-Governance-RG to create both lock types and verify their behavior using the Azure Portal and Azure CLI.
Resource Group: AZ104-Governance-RG
Sign in to Azure Portal Navigate to portal.azure.com and sign in with your Azure account credentials.
Open Your Resource Group In the search bar, type Resource groups and click the service. Locate and click on AZ104-Governance-RG.

Navigate to Locks In the left-hand menu (Settings section), click Locks. Home โบ Resource groups โบ AZ104-Governance-RG โบ Settings โบ Locks

Add a New Lock Click + Add button at the top. Fill in the form: โข Lock name:DoNotDelete-Governance-Lock
โข Lock type: Delete

โข Notes: Prevents accidental deletion of governance resources
Save the Lock Click OK to apply the lock. The lock will appear in the Locks list within seconds.

โ Verify: Attempt to delete the resource group by clicking “Delete resource group” in the Overview blade. You should see the error: “The scope ‘AZ104-Governance-RG’ cannot be deleted because it has a delete lock.”
PowerShell & CLI approach for automation
Azure CLI โ CanNotDelete Lockbash
# Create a CanNotDelete lock on AZ104-Governance-RG az lock create \ --name "DoNotDelete-Governance-Lock" \ --resource-group "AZ104-Governance-RG" \ --lock-type CanNotDelete \ --notes "Protects governance resources from accidental deletion" # List all locks on the resource group az lock list \ --resource-group "AZ104-Governance-RG" \ --output table # Delete the lock when no longer needed az lock delete \ --name "DoNotDelete-Governance-Lock" \ --resource-group "AZ104-Governance-RG"

PowerShell โ ReadOnly Lockps1
# Connect to Azure (if not already connected) Connect-AzAccount # Create a ReadOnly lock on the resource group New-AzResourceLock ` -LockName "ReadOnly-Governance-Lock" ` -LockLevel ReadOnly ` -ResourceGroupName "AZ104-Governance-RG" ` -LockNotes "Full read-only protection during maintenance" ` -Force # View all locks Get-AzResourceLock -ResourceGroupName "AZ104-Governance-RG" # Remove the lock $lock = Get-AzResourceLock ` -LockName "ReadOnly-Governance-Lock" ` -ResourceGroupName "AZ104-Governance-RG" Remove-AzResourceLock -LockId $lock.LockId -Force
In this lab, we will move a resource from AZ104-Governance-RG to a new destination resource group using the Azure Portal and PowerShell.
๐
Pre-requisite: Ensure no ReadOnly lock is active on AZ104-Governance-RG before proceeding. A CanNotDelete lock is fine โ it will not block the move operation.
Move a storage account or VM to a new resource group
Create Destination Resource Group In the Azure Portal, go to Resource groups โ click + Create. Create a new group named AZ104-Destination-RG in the same region as AZ104-Governance-RG.

Select the Resource to Move Open AZ104-Governance-RG. In the resource list, check the checkbox next to the resource you want to move (e.g., a Storage Account).
Initiate the Move Click the Move button in the top toolbar. Select “Move to another resource group” from the dropdown. AZ104-Governance-RG โบ [Select Resource] โบ Move โบ Move to another resource group

AZ104-Destination-RG/resourceGroups/AZ104-Destination-RG/.Automate resource movement via PowerShell
PowerShell โ Move Resourceps1
# Define variables
$sourceRG = "AZ104-Governance-RG"
$destinationRG = "AZ104-Destination-RG"
$subscriptionId = "<your-subscription-id>"
# Get the resource you want to move
$resource = Get-AzResource `
-ResourceGroupName $sourceRG `
-ResourceName "myStorageAccount"
# Create destination resource group (if not exists)
New-AzResourceGroup `
-Name $destinationRG `
-Location "East US"
# Validate the move first (recommended)
Invoke-AzResourceAction `
-Action "validateMoveResources" `
-ResourceId "/subscriptions/$subscriptionId/resourceGroups/$sourceRG" `
-Parameters @{
resources = @($resource.ResourceId)
targetResourceGroup = "/subscriptions/$subscriptionId/resourceGroups/$destinationRG"
}
# Perform the actual move
Move-AzResource `
-ResourceId $resource.ResourceId `
-DestinationResourceGroupName $destinationRG `
-Force
Write-Host "โ
Resource moved successfully to $destinationRG"
Azure CLI โ Move Resourcebash
# Get Resource ID of the resource to move RESOURCE_ID=$(az resource show \ --resource-group "AZ104-Governance-RG" \ --name "myStorageAccount" \ --resource-type "Microsoft.Storage/storageAccounts" \ --query id --output tsv) # Create destination resource group az group create \ --name "AZ104-Destination-RG" \ --location "eastus" # Move the resource az resource move \ --destination-group "AZ104-Destination-RG" \ --ids $RESOURCE_ID # Confirm the move az resource list \ --resource-group "AZ104-Destination-RG" \ --output table
| Operation | Azure CLI | PowerShell |
|---|---|---|
| Create CanNotDelete Lock | az lock create --lock-type CanNotDelete | New-AzResourceLock -LockLevel CanNotDelete |
| Create ReadOnly Lock | az lock create --lock-type ReadOnly | New-AzResourceLock -LockLevel ReadOnly |
| List Locks | az lock list -g <RG> | Get-AzResourceLock -ResourceGroupName <RG> |
| Delete Lock | az lock delete --name <name> | Remove-AzResourceLock -LockId <id> |
| Move Resource | az resource move --ids <id> | Move-AzResource -ResourceId <id> |
Practice these governance concepts in your Azure free account using the lab steps above. Hands-on practice is the fastest path to certification.