Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report]: Resource Group modules for Managedby #4555

Open
Grant-Rc opened this issue Jan 23, 2025 · 0 comments
Open

[Bug Report]: Resource Group modules for Managedby #4555

Grant-Rc opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Grant-Rc
Copy link

Grant-Rc commented Jan 23, 2025

Describe the bug

When updating from the old resources modules, the below code set the managedBy to ''

@description('Optional. The ID of the resource that manages this resource group.')
param managedBy string = ''


resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  location: location
  name: name
  tags: tags
  managedBy: managedBy
  properties: {}
}

In the new AVM modules its commented out and so its reverts to $null

resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  location: location
  name: name
  tags: tags
  // managedBy: managedBy // removed due to immutable string, only used for managed resource groups
  properties: {}
}

When testing, it will try and update the property but this is not allowed

 "details": [
    {
      "code": "ResourceGroupManagedByMismatch",
      "message": "The managed by property of the resource group cannot be changed from its current value ''."
    }
  ]

To reproduce

Deploy a resource group using the resource deployment of

resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  location: location
  name: name
  tags: tags
  managedBy: managedBy
  properties: {}
}

Update the code to comment out the managedBy property

resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  location: location
  name: name
  tags: tags
  // managedBy: managedBy // removed due to immutable string, only used for managed resource groups
  properties: {}
}

Code snippet

resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  location: location
  name: name
  tags: tags
  managedBy: managedBy
  properties: {}
}

resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  location: location
  name: name
  tags: tags
  // managedBy: managedBy // removed due to immutable string, only used for managed resource groups
  properties: {}
}

Relevant log output

"details": [
    {
      "code": "ResourceGroupManagedByMismatch",
      "message": "The managed by property of the resource group cannot be changed from its current value ''."
    }
  ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Needs triage
Development

No branches or pull requests

1 participant