Skip to content

Commit 1ac62d1

Browse files
Merge pull request #819 from microsoft/psl-tag-issue
fix: Resolved the tag issue
2 parents 25d46e1 + c9dcd1d commit 1ac62d1

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

infra/main.bicep

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ var allTags = union(
225225
},
226226
tags
227227
)
228+
var existingTags = resourceGroup().tags ?? {}
228229
@description('Tag, Created by user name')
229230
param createdBy string = contains(deployer(), 'userPrincipalName')
230231
? split(deployer().userPrincipalName, '@')[0]
@@ -234,15 +235,17 @@ var deployerPrincipalType = contains(deployer(), 'userPrincipalName') ? 'User' :
234235
resource resourceGroupTags 'Microsoft.Resources/tags@2021-04-01' = {
235236
name: 'default'
236237
properties: {
237-
tags: {
238-
...resourceGroup().tags
239-
...allTags
240-
TemplateName: 'MACAE'
241-
Type: enablePrivateNetworking ? 'WAF' : 'Non-WAF'
242-
CreatedBy: createdBy
243-
DeploymentName: deployment().name
244-
SolutionSuffix: solutionSuffix
245-
}
238+
tags: union(
239+
existingTags,
240+
allTags,
241+
{
242+
TemplateName: 'MACAE'
243+
Type: enablePrivateNetworking ? 'WAF' : 'Non-WAF'
244+
CreatedBy: createdBy
245+
DeploymentName: deployment().name
246+
SolutionSuffix: solutionSuffix
247+
}
248+
)
246249
}
247250
}
248251

infra/main_custom.bicep

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ var allTags = union(
224224
},
225225
tags
226226
)
227+
var existingTags = resourceGroup().tags ?? {}
227228
@description('Tag, Created by user name')
228229
param createdBy string = contains(deployer(), 'userPrincipalName')
229230
? split(deployer().userPrincipalName, '@')[0]
@@ -233,14 +234,17 @@ var deployerPrincipalType = contains(deployer(), 'userPrincipalName') ? 'User' :
233234
resource resourceGroupTags 'Microsoft.Resources/tags@2021-04-01' = {
234235
name: 'default'
235236
properties: {
236-
tags: {
237-
...allTags
238-
TemplateName: 'MACAE'
239-
Type: enablePrivateNetworking ? 'WAF' : 'Non-WAF'
240-
CreatedBy: createdBy
241-
DeploymentName: deployment().name
242-
SolutionSuffix: solutionSuffix
243-
}
237+
tags: union(
238+
existingTags,
239+
allTags,
240+
{
241+
TemplateName: 'MACAE'
242+
Type: enablePrivateNetworking ? 'WAF' : 'Non-WAF'
243+
CreatedBy: createdBy
244+
DeploymentName: deployment().name
245+
SolutionSuffix: solutionSuffix
246+
}
247+
)
244248
}
245249
}
246250

0 commit comments

Comments
 (0)