question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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: Bug

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:closed
  • Created 4 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zhoxing-mscommented, Mar 9, 2020

@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.

1reaction
zhoxing-mscommented, Mar 9, 2020

@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:

  1. az lock create --name {lock-name} --lock-type ReadOnly --resource-group {resource-group} --resource-type Microsoft.Network/virtualNetworks --resource {virtualNetwork-name}/subnets/{subnet-name}
  2. 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)
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found