Skip to content

[Bug Report]: resources/resource-group - ResourceGroupManagedByMismatch #3386

@coolhome

Description

@coolhome

Describe the bug

Azure defaults ResourceGroup.managedBy as null but the ResourceModule template defaults to empty string. It is also not possible to set null with this module.

image

If I check if empty and send null then I get another error:

InvalidTemplate - Long running operation failed with status 'Failed'.
     | Additional Info:'Deployment template validation failed: 'The template
     | resource 'RG-Workday' at line '1' and column '2529' is not valid:
     | Evaluation result of language expression
     | '[if(empty(parameters('managedBy')), null(), parameters('managedBy'))]'
     | is type 'Null', expected type is 'String'.. Please see
     | https://aka.ms/arm-functions for usage details.'.

To reproduce

  1. Create a resource group through azure portal
  2. Create bicep for this resource group
module ResourceGroup '.carml/resources/resource-groups/main.bicep' = {
  name: '${deployment().name}-ResourceGroup'
  params: {
    name: resourceGroupName
    location: resourceGroupLocation
  }
}
  1. Deploy Bicep
The managed by property of the resource group cannot be changed from its current value '<null>'

Code snippet

No response

Relevant log output

{
  "code": "DeploymentFailed",
  "target": "/subscriptions/***",
  "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.",
  "details": [
    {
      "code": "ResourceGroupManagedByMismatch",
      "message": "The managed by property of the resource group cannot be changed from its current value '<null>'."
    }
  ]
}

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions