Skip to content
Discussion options

You must be logged in to vote

@pradeep-reddy118

  • You can use the scope property to setup the lock on the resource.
@maxLength(24)
param storageName string = 'myimportantsa897'

resource storageaccount 'Microsoft.Storage/storageAccounts@2021-02-01' = {
  name: storageName
  location: resourceGroup().location
  kind: 'StorageV2'
  sku: {
    name: 'Premium_LRS'
  }
}

resource lock 'Microsoft.Authorization/locks@2020-05-01' = {
  name: 'mylock'
  scope: storageaccount
  properties: {
    level: 'CanNotDelete'
    notes: 'This is a lock'
  }
  
}
  • If the resource is not being deployed in the same template, then you can just update the first part with the existing reference for the scope.
resource storageaccount 'Micros…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@brwilkinson
Comment options

Answer selected by brwilkinson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants