-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #370 from richardsondev/jorichar/SystemAssignedUse…
…rAssignedRule [Built-in rule] Add `SystemAssigned, UserAssigned` as an allowed identity on TA-000007, TA-000013, TA-000019
- Loading branch information
Showing
11 changed files
with
722 additions
and
6 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
92 changes: 92 additions & 0 deletions
92
src/Analyzer.Core.BuiltInRuleTests/Tests/TA-000007/AppServiceAPIApps.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,92 @@ | ||
@description('Location for all resources.') | ||
param location string = resourceGroup().location | ||
|
||
resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { | ||
name: 'managedIdentity' | ||
location: location | ||
} | ||
resource missingIdentity 'Microsoft.Web/sites@2019-08-01' = { | ||
kind: 'api' | ||
name: 'missingIdentity' | ||
location: location | ||
properties: { | ||
siteConfig: { | ||
detailedErrorLoggingEnabled: false | ||
httpLoggingEnabled: false | ||
requestTracingEnabled: false | ||
} | ||
} | ||
} | ||
|
||
resource systemManagedIdentity 'Microsoft.Web/sites@2019-08-01' = { | ||
kind: 'api' | ||
name: 'systemManagedIdentity' | ||
location: location | ||
properties: { | ||
siteConfig: { | ||
detailedErrorLoggingEnabled: false | ||
httpLoggingEnabled: false | ||
requestTracingEnabled: false | ||
} | ||
} | ||
identity: { | ||
type: 'SystemAssigned' | ||
} | ||
} | ||
|
||
resource userManagedIdentity 'Microsoft.Web/sites@2019-08-01' = { | ||
kind: 'api' | ||
name: 'userManagedIdentity' | ||
location: location | ||
properties: { | ||
siteConfig: { | ||
detailedErrorLoggingEnabled: false | ||
httpLoggingEnabled: false | ||
requestTracingEnabled: false | ||
} | ||
} | ||
identity: { | ||
type: 'UserAssigned' | ||
userAssignedIdentities: { | ||
'${managedIdentity.id}': {} | ||
} | ||
} | ||
} | ||
|
||
resource systemAndUserManagedIdentity 'Microsoft.Web/sites@2019-08-01' = { | ||
kind: 'api' | ||
name: 'systemAndUserManagedIdentity' | ||
location: location | ||
properties: { | ||
siteConfig: { | ||
detailedErrorLoggingEnabled: false | ||
httpLoggingEnabled: false | ||
requestTracingEnabled: false | ||
} | ||
} | ||
identity: { | ||
type: 'SystemAssigned,UserAssigned' | ||
userAssignedIdentities: { | ||
'${managedIdentity.id}': {} | ||
} | ||
} | ||
} | ||
|
||
resource systemAndUserManagedWithSpaceIdentity 'Microsoft.Web/sites@2019-08-01' = { | ||
kind: 'api' | ||
name: 'systemAndUserManagedWithSpaceIdentity' | ||
location: location | ||
properties: { | ||
siteConfig: { | ||
detailedErrorLoggingEnabled: false | ||
httpLoggingEnabled: false | ||
requestTracingEnabled: false | ||
} | ||
} | ||
identity: { | ||
type: 'SystemAssigned, UserAssigned' | ||
userAssignedIdentities: { | ||
'${managedIdentity.id}': {} | ||
} | ||
} | ||
} |
121 changes: 121 additions & 0 deletions
121
src/Analyzer.Core.BuiltInRuleTests/Tests/TA-000007/AppServiceAPIApps.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,121 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"location": { | ||
"type": "string", | ||
"defaultValue": "[resourceGroup().location]", | ||
"metadata": { | ||
"description": "Location for all resources." | ||
} | ||
} | ||
}, | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.ManagedIdentity/userAssignedIdentities", | ||
"apiVersion": "2018-11-30", | ||
"name": "managedIdentity", | ||
"location": "[parameters('location')]" | ||
}, | ||
{ | ||
"type": "Microsoft.Web/sites", | ||
"apiVersion": "2019-08-01", | ||
"name": "missingIdentity", | ||
"kind": "api", | ||
"location": "[parameters('location')]", | ||
"properties": { | ||
"siteConfig": { | ||
"detailedErrorLoggingEnabled": false, | ||
"httpLoggingEnabled": false, | ||
"requestTracingEnabled": false | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Web/sites", | ||
"apiVersion": "2019-08-01", | ||
"name": "systemManagedIdentity", | ||
"kind": "api", | ||
"location": "[parameters('location')]", | ||
"properties": { | ||
"siteConfig": { | ||
"detailedErrorLoggingEnabled": false, | ||
"httpLoggingEnabled": false, | ||
"requestTracingEnabled": false | ||
} | ||
}, | ||
"identity": { | ||
"type": "SystemAssigned" | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Web/sites", | ||
"apiVersion": "2019-08-01", | ||
"name": "userManagedIdentity", | ||
"kind": "api", | ||
"location": "[parameters('location')]", | ||
"properties": { | ||
"siteConfig": { | ||
"detailedErrorLoggingEnabled": false, | ||
"httpLoggingEnabled": false, | ||
"requestTracingEnabled": false | ||
} | ||
}, | ||
"identity": { | ||
"type": "UserAssigned", | ||
"userAssignedIdentities": { | ||
"[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'managedIdentity'))]": {} | ||
} | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'managedIdentity')]" | ||
] | ||
}, | ||
{ | ||
"type": "Microsoft.Web/sites", | ||
"apiVersion": "2019-08-01", | ||
"name": "systemAndUserManagedIdentity", | ||
"kind": "api", | ||
"location": "[parameters('location')]", | ||
"properties": { | ||
"siteConfig": { | ||
"detailedErrorLoggingEnabled": false, | ||
"httpLoggingEnabled": false, | ||
"requestTracingEnabled": false | ||
} | ||
}, | ||
"identity": { | ||
"type": "SystemAssigned,UserAssigned", | ||
"userAssignedIdentities": { | ||
"[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'managedIdentity'))]": {} | ||
} | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'managedIdentity')]" | ||
] | ||
}, | ||
{ | ||
"type": "Microsoft.Web/sites", | ||
"apiVersion": "2019-08-01", | ||
"name": "systemAndUserManagedWithSpaceIdentity", | ||
"kind": "api", | ||
"location": "[parameters('location')]", | ||
"properties": { | ||
"siteConfig": { | ||
"detailedErrorLoggingEnabled": false, | ||
"httpLoggingEnabled": false, | ||
"requestTracingEnabled": false | ||
} | ||
}, | ||
"identity": { | ||
"type": "SystemAssigned, UserAssigned", | ||
"userAssignedIdentities": { | ||
"[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'managedIdentity'))]": {} | ||
} | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'managedIdentity')]" | ||
] | ||
} | ||
] | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Analyzer.Core.BuiltInRuleTests/Tests/TA-000007/TA-000007.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,15 @@ | ||
[ | ||
{ | ||
"Template": "AppServiceAPIApps.json", | ||
"ReportedFailures": [ | ||
{ | ||
"LineNumber": 20, | ||
"Description": "API app is missing an identity declaration." | ||
}, | ||
{ | ||
"LineNumber": 88, | ||
"Description": "Multiple identity types should be separated by a comma, followed by a space." | ||
} | ||
] | ||
} | ||
] |
92 changes: 92 additions & 0 deletions
92
src/Analyzer.Core.BuiltInRuleTests/Tests/TA-000013/AppServiceFunctionApps.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,92 @@ | ||
@description('Location for all resources.') | ||
param location string = resourceGroup().location | ||
|
||
resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { | ||
name: 'managedIdentity' | ||
location: location | ||
} | ||
resource missingIdentity 'Microsoft.Web/sites@2019-08-01' = { | ||
kind: 'functionapp' | ||
name: 'missingIdentity' | ||
location: location | ||
properties: { | ||
siteConfig: { | ||
detailedErrorLoggingEnabled: false | ||
httpLoggingEnabled: false | ||
requestTracingEnabled: false | ||
} | ||
} | ||
} | ||
|
||
resource systemManagedIdentity 'Microsoft.Web/sites@2019-08-01' = { | ||
kind: 'functionapp' | ||
name: 'systemManagedIdentity' | ||
location: location | ||
properties: { | ||
siteConfig: { | ||
detailedErrorLoggingEnabled: false | ||
httpLoggingEnabled: false | ||
requestTracingEnabled: false | ||
} | ||
} | ||
identity: { | ||
type: 'SystemAssigned' | ||
} | ||
} | ||
|
||
resource userManagedIdentity 'Microsoft.Web/sites@2019-08-01' = { | ||
kind: 'functionapp' | ||
name: 'userManagedIdentity' | ||
location: location | ||
properties: { | ||
siteConfig: { | ||
detailedErrorLoggingEnabled: false | ||
httpLoggingEnabled: false | ||
requestTracingEnabled: false | ||
} | ||
} | ||
identity: { | ||
type: 'UserAssigned' | ||
userAssignedIdentities: { | ||
'${managedIdentity.id}': {} | ||
} | ||
} | ||
} | ||
|
||
resource systemAndUserManagedIdentity 'Microsoft.Web/sites@2019-08-01' = { | ||
kind: 'functionapp' | ||
name: 'systemAndUserManagedIdentity' | ||
location: location | ||
properties: { | ||
siteConfig: { | ||
detailedErrorLoggingEnabled: false | ||
httpLoggingEnabled: false | ||
requestTracingEnabled: false | ||
} | ||
} | ||
identity: { | ||
type: 'SystemAssigned,UserAssigned' | ||
userAssignedIdentities: { | ||
'${managedIdentity.id}': {} | ||
} | ||
} | ||
} | ||
|
||
resource systemAndUserManagedWithSpaceIdentity 'Microsoft.Web/sites@2019-08-01' = { | ||
kind: 'functionapp' | ||
name: 'systemAndUserManagedWithSpaceIdentity' | ||
location: location | ||
properties: { | ||
siteConfig: { | ||
detailedErrorLoggingEnabled: false | ||
httpLoggingEnabled: false | ||
requestTracingEnabled: false | ||
} | ||
} | ||
identity: { | ||
type: 'SystemAssigned, UserAssigned' | ||
userAssignedIdentities: { | ||
'${managedIdentity.id}': {} | ||
} | ||
} | ||
} |
Oops, something went wrong.