
## Review A dedicated reviewer checked the rule description successfully for: - [x] logical errors and incorrect information - [x] information gaps and missing content - [x] text style and tone - [x] PR summary and labels follow [the guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule)
74 lines
1.6 KiB
Plaintext
74 lines
1.6 KiB
Plaintext
include::../description.adoc[]
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
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]
|
|
----
|
|
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"resources": [
|
|
{
|
|
"name": "example",
|
|
"type": "Microsoft.Authorization/roleAssignments",
|
|
"apiVersion": "2022-04-01",
|
|
"name": "[guid(subscription().id, 'exampleRoleAssignment')]"
|
|
}
|
|
]
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
[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=compliant]
|
|
----
|
|
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"resources": [
|
|
{
|
|
"name": "example",
|
|
"type": "Microsoft.Authorization/roleAssignments",
|
|
"apiVersion": "2022-04-01",
|
|
"name": "[guid(resourceGroup().id, 'exampleRoleAssignment')]"
|
|
}
|
|
]
|
|
}
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
include::highlighting.adoc[]
|
|
|
|
endif::env-github,rspecator-view[] |