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 GetBicepParamResources exception when expanding Microsoft Graph A…
- Loading branch information
1 parent
25a6389
commit 194b235
Showing
8 changed files
with
181 additions
and
1 deletion.
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
45 changes: 45 additions & 0 deletions
45
tests/PSRule.Rules.Azure.Tests/Bicep/ExtensibilityTestCases/Tests.Bicep.1.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,45 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// Test case for https://github.com/Azure/PSRule.Rules.Azure/issues/3062 | ||
|
||
extension microsoftGraphV1_0 | ||
|
||
var appRoleId = 'appRoleId' | ||
var certKey = 'certKey' | ||
|
||
resource resourceApp 'Microsoft.Graph/[email protected]' = { | ||
uniqueName: 'ExampleResourceApp' | ||
displayName: 'Example Resource Application' | ||
appRoles: [ | ||
{ | ||
id: appRoleId | ||
allowedMemberTypes: ['User', 'Application'] | ||
description: 'Read access to resource app data' | ||
displayName: 'ResourceAppData.Read.All' | ||
value: 'ResourceAppData.Read.All' | ||
isEnabled: true | ||
} | ||
] | ||
} | ||
|
||
resource resourceSp 'Microsoft.Graph/[email protected]' = { | ||
appId: resourceApp.appId | ||
} | ||
|
||
resource clientApp 'Microsoft.Graph/[email protected]' = { | ||
uniqueName: 'ExampleClientApp' | ||
displayName: 'Example Client Application' | ||
keyCredentials: [ | ||
{ | ||
displayName: 'Example Client App Key Credential' | ||
usage: 'Verify' | ||
type: 'AsymmetricX509Cert' | ||
key: certKey | ||
} | ||
] | ||
} | ||
|
||
resource clientSp 'Microsoft.Graph/[email protected]' = { | ||
appId: clientApp.appId | ||
} |
85 changes: 85 additions & 0 deletions
85
tests/PSRule.Rules.Azure.Tests/Bicep/ExtensibilityTestCases/Tests.Bicep.1.json
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,85 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"languageVersion": "2.1-experimental", | ||
"contentVersion": "1.0.0.0", | ||
"metadata": { | ||
"_EXPERIMENTAL_WARNING": "This template uses ARM features that are experimental. Experimental features should be enabled for testing purposes only, as there are no guarantees about the quality or stability of these features. Do not enable these settings for any production usage, or your production environment may be subject to breaking.", | ||
"_EXPERIMENTAL_FEATURES_ENABLED": [ | ||
"Extensibility" | ||
], | ||
"_generator": { | ||
"name": "bicep", | ||
"version": "0.30.23.60470", | ||
"templateHash": "2001503425732761903" | ||
} | ||
}, | ||
"variables": { | ||
"appRoleId": "appRoleId", | ||
"certKey": "certKey" | ||
}, | ||
"imports": { | ||
"MicrosoftGraph": { | ||
"provider": "MicrosoftGraph", | ||
"version": "0.1.8-preview" | ||
} | ||
}, | ||
"resources": { | ||
"resourceApp": { | ||
"import": "MicrosoftGraph", | ||
"type": "Microsoft.Graph/[email protected]", | ||
"properties": { | ||
"uniqueName": "ExampleResourceApp", | ||
"displayName": "Example Resource Application", | ||
"appRoles": [ | ||
{ | ||
"id": "[variables('appRoleId')]", | ||
"allowedMemberTypes": [ | ||
"User", | ||
"Application" | ||
], | ||
"description": "Read access to resource app data", | ||
"displayName": "ResourceAppData.Read.All", | ||
"value": "ResourceAppData.Read.All", | ||
"isEnabled": true | ||
} | ||
] | ||
} | ||
}, | ||
"resourceSp": { | ||
"import": "MicrosoftGraph", | ||
"type": "Microsoft.Graph/[email protected]", | ||
"properties": { | ||
"appId": "[reference('resourceApp').appId]" | ||
}, | ||
"dependsOn": [ | ||
"resourceApp" | ||
] | ||
}, | ||
"clientApp": { | ||
"import": "MicrosoftGraph", | ||
"type": "Microsoft.Graph/[email protected]", | ||
"properties": { | ||
"uniqueName": "ExampleClientApp", | ||
"displayName": "Example Client Application", | ||
"keyCredentials": [ | ||
{ | ||
"displayName": "Example Client App Key Credential", | ||
"usage": "Verify", | ||
"type": "AsymmetricX509Cert", | ||
"key": "[variables('certKey')]" | ||
} | ||
] | ||
} | ||
}, | ||
"clientSp": { | ||
"import": "MicrosoftGraph", | ||
"type": "Microsoft.Graph/[email protected]", | ||
"properties": { | ||
"appId": "[reference('clientApp').appId]" | ||
}, | ||
"dependsOn": [ | ||
"clientApp" | ||
] | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/PSRule.Rules.Azure.Tests/Bicep/ExtensibilityTestCases/bicepconfig.json
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,9 @@ | ||
{ | ||
"experimentalFeaturesEnabled": { | ||
"optionalModuleNames": true, | ||
"extensibility": true | ||
}, | ||
"extensions": { | ||
"microsoftGraphV1_0": "br:mcr.microsoft.com/bicep/extensions/microsoftgraph/v1.0:0.1.8-preview" | ||
} | ||
} |
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