Instantly share code, notes, and snippets.

Embed
What would you like to do?
#Resource Lock
$LockName = "LockCloudWitnes"
$ResourceName = "pixelcloudwitness"
$ResourceType = (Get-AzureRmResource -Name $ResourceName).resourcetype
$RGName ="PIXELLAB"
New-AzureRmResourceLock -LockLevel CanNotDelete -LockName $LockName -ResourceName $ResourceName -ResourceType $ResourceType -ResourceGroupName $RGName
#Resource Group Lock
$LockName = "PIXELLABLock"
$RGName ="PIXELLAB"
New-AzureRmResourceLock -LockName $LockName -LockLevel CanNotDelete -ResourceGroupName $RGName
#Remove Lock from resource
$LockName = "LockCloudWitnes"
$RGName ="PIXELLAB"
$ResourceName = "pixelcloudwitness"
$ResourceType = (Get-AzureRmResource -Name $ResourceName).resourcetype
Remove-AzureRmResourceLock -LockName $LockName -ResourceName $ResourceName -ResourceGroupName $RGName -ResourceType $ResourceType
#Remove Lock from resource group
$LockName = "PIXELLABLock"
$RGName ="PIXELLAB"
Remove-AzureRmResourceLock -LockName $LockName -ResourceGroupName $RGName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment