Modify rule S6387: Add language AzureResourceManager (Bicep) (#1907)

This commit is contained in:
Egon Okerman 2023-09-13 10:25:18 +02:00 committed by GitHub
parent 897bb45fbf
commit 4c61cfe3b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 10 deletions

View File

@ -0,0 +1,8 @@
=== Highlighting
==== JSON
Highlight the relevant `$schema` property
==== Bicep
Highlight the relevant `targetScope` property

View File

@ -6,6 +6,15 @@ include::../recommended.adoc[]
== Sensitive Code Example
[source,bicep,diff-id=1,diff-type=noncompliant]
----
targetScope = 'subscription' // Sensitive
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(subscription().id, 'exampleRoleAssignment')
}
----
[source,json,diff-id=2,diff-type=noncompliant]
----
{
@ -23,7 +32,16 @@ include::../recommended.adoc[]
== Compliant Solution
[source,json,diff-id=2,diff-type=compliant]
[source,bicep,diff-id=1,diff-type=compliant]
----
targetScope = 'resourceGroup'
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(resourceGroup().id, 'exampleRoleAssignment')
}
----
[source,json,diff-id=2,diff-type=noncompliant]
----
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
@ -49,14 +67,6 @@ ifdef::env-github,rspecator-view[]
include::../message.adoc[]
=== Highlighting
==== JSON
Highlight the relevant `$schema` property
==== Bicep
Highlight the relevant `targetScope` property
include::highlighting.adoc[]
endif::env-github,rspecator-view[]