forked from Azure/PSRule.Rules.Azure
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Resource group ID is incorrect under subscription scope Azure#3198
(Azure#3199) * Fixed Resource group ID is incorrect under subscription scope Azure#3198 * Add contribution
- Loading branch information
1 parent
375e4e5
commit fa40383
Showing
9 changed files
with
351 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tests/PSRule.Rules.Azure.Tests/Bicep/ScopeTestCases/Tests.Bicep.2.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
targetScope = 'subscription' | ||
|
||
param location string = deployment().location | ||
|
||
@description('') | ||
param tags object = {} | ||
|
||
resource rg 'Microsoft.Resources/resourceGroups@2024-07-01' = { | ||
name: 'rg-1' | ||
location: location | ||
tags: tags | ||
} | ||
|
||
module id './Tests.Bicep.2.child2.bicep' = { | ||
scope: rg | ||
name: 'id-deploy' | ||
params: { | ||
name: 'id-1' | ||
location: location | ||
tags: tags | ||
} | ||
} | ||
|
||
module registry './Tests.Bicep.2.child1.bicep' = { | ||
scope: rg | ||
name: 'registry-deploy' | ||
params: { | ||
location: location | ||
name: 'registry-1' | ||
tags: tags | ||
identityId: id.outputs.id | ||
} | ||
} | ||
|
||
output userAssignedIdentityId string = id.outputs.id | ||
output registryId string = registry.outputs.id |
36 changes: 36 additions & 0 deletions
36
tests/PSRule.Rules.Azure.Tests/Bicep/ScopeTestCases/Tests.Bicep.2.child1.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
targetScope = 'resourceGroup' | ||
|
||
param name string | ||
param location string | ||
param identityId string | ||
param tags object | ||
|
||
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2023-11-01-preview' = { | ||
name: name | ||
location: location | ||
identity: { | ||
type: 'UserAssigned' | ||
userAssignedIdentities: { | ||
'${identityId}': {} | ||
} | ||
} | ||
sku: { | ||
name: 'Premium' | ||
} | ||
tags: tags | ||
properties: { | ||
adminUserEnabled: false | ||
policies: { | ||
azureADAuthenticationAsArmPolicy: { | ||
status: 'enabled' | ||
} | ||
} | ||
} | ||
} | ||
|
||
output id string = containerRegistry.id | ||
output url string = containerRegistry.properties.loginServer | ||
output identity object = containerRegistry.identity.userAssignedIdentities |
14 changes: 14 additions & 0 deletions
14
tests/PSRule.Rules.Azure.Tests/Bicep/ScopeTestCases/Tests.Bicep.2.child2.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
param name string | ||
param location string | ||
param tags object | ||
|
||
resource id 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { | ||
name: name | ||
location: location | ||
tags: tags | ||
} | ||
|
||
output id string = id.id |
Oops, something went wrong.