Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 9 commits into from
Sep 13, 2023
8 changes: 8 additions & 0 deletions rules/S6387/azureresourcemanager/highlighting.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=== Highlighting
==== JSON

Highlight the relevant `$schema` property

==== Bicep

Highlight the relevant `targetScope` property
30 changes: 20 additions & 10 deletions rules/S6387/azureresourcemanager/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
----
{
Expand All @@ -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]
egon-okerman-sonarsource marked this conversation as resolved.
Show resolved Hide resolved
----
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
Expand All @@ -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[]