az lock create does not allow to set resource locks for VNet subnets
See original GitHub issue
az feedback
auto-generates most of the information requested below, as of CLI version
2.0.81
Describe the bug
az lock create
does not allow to set resource locks for VNet subnets. The following error is shown:
validation error: Parameter ‘resource_provider_namespace’ can not be None.
To Reproduce
See this screenshot below - basically setting a resource lock on a VNet works, but setting a resource lock in one of it’s VNet subnets results in an error:
Expected behavior Locking a VNet subnet should be supported.
Environment summary Azure Cloud Shell (Bash) with Azure CLI 2.0.81 installed
Additional context Not sure if resource locking a VNet subnet is supported by Azure in general.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Protect your Azure resources with a lock - Microsoft Learn
You can safeguard Azure resources from updates or deletions by locking all users and roles.
Read more >azure cli list resources in resource group - Caseificio de Nicola
0 command az group exists to test the resource group exist or not, ... In new resource group, we can create new Vnet...
Read more >The Purpose and Pain of Azure Resource Locks
Azure Resource locks are a feature available in Azure to prevent the removal or change of resources within an Azure tenant (depending on...
Read more >Preparing a cluster to use Azure Red Hat OpenShift (ARO) - IBM
The following steps are based on the Microsoft tutorial for creating an ARO cluster: ... az network vnet subnet create \ --resource-group $RESOURCEGROUP ......
Read more >Custom Role should be assigned for administering resource ...
Below is a PowerShell definition for a resource lock administrator role created at an Azure Management group level: Import-Module Az.Accounts ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@fawohlsc However, I found that there is no entry on portal to support locking subnets granular resources, please help to confirm whether this function is reasonable and needed? If so, please contact members of the portal team to add the ability to lock subnets granular resources. And I will supplement this example in the CLI help documentation.
@fawohlsc Hi, if you want to lock subnets, the service needs to know which virtualNetworks the subnets belong to. There are two correct command formats:
az lock create --name {lock-name} --lock-type ReadOnly --resource-group {resource-group} --resource-type Microsoft.Network/virtualNetworks --resource {virtualNetwork-name}/subnets/{subnet-name}
az lock create --name {lock-name} --lock-type ReadOnly --resource-group {resource-group} --resource-type Microsoft.Network/subnets --parent virtualNetworks/{virtualNetwork-name} --resource {subnet-name}
(more recommended)