Azure / Azure/ResourceModules

[Bug Report]: Resource Group modules for Managedby

Offen
#4,555 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
PowerShell
Sterne
737
Forks
436
Ø Merge
10 T. 7 Std.
Gemergte PRs (30 T.)
1

Beschreibung

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

```Bicep
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

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit dem Resource Group AVM module und seiner Ressourcendeklaration und vergleiche das frühere managedBy-Verhalten mit der aktuell auskommentierten property. Reproduziere die Aktualisierung aus dem Issue und überprüfe, dass das module keinen ResourceGroupManagedByMismatch-Fehler mehr erzeugt und dabei das beabsichtigte Verhalten der verwalteten Ressourcengruppe erhalten bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
azure
Bereich
cloud, infrastructure
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.