-
Notifications
You must be signed in to change notification settings - Fork 3
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 #23 from ndergal1/ndergal/fix/custom-role-for-indi…
…vidual-subscriptions Modify assignable scope of existing custom role cs-website-reader
- Loading branch information
Showing
9 changed files
with
156 additions
and
72 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
targetScope = 'subscription' | ||
|
||
param customRoleName string | ||
|
||
resource existingCustomRoleDefinition 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = { | ||
name: guid(customRoleName, subscription().id) | ||
} | ||
|
||
output assignableScopes array = existingCustomRoleDefinition.properties.assignableScopes |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
targetScope = 'subscription' | ||
|
||
/* | ||
This Bicep template adds the subscription as an assignable scope on the required permissions to enable CrowdStrike | ||
Indicator of Misconfiguration (IOM) | ||
Copyright (c) 2024 CrowdStrike, Inc. | ||
*/ | ||
|
||
@description('Subscription Id of the targeted Azure Subscription.') | ||
param subscriptionId string | ||
|
||
var customRole = { | ||
roleName: 'cs-website-reader' | ||
roleDescription: 'CrowdStrike custom role to allow read access to App Service and Function.' | ||
roleActions: [ | ||
'Microsoft.Web/sites/Read' | ||
'Microsoft.Web/sites/config/Read' | ||
'Microsoft.Web/sites/config/list/Action' | ||
] | ||
} | ||
|
||
module assignableScope 'azureRoleDefinitionAssignableScope.bicep' = { | ||
name: guid('getAssignableScope',customRole.roleName, subscription().id) | ||
params: { | ||
customRoleName: customRole.roleName | ||
} | ||
} | ||
|
||
resource modifyExistingCustomRoleDefinition 'Microsoft.Authorization/roleDefinitions@2022-04-01' = { | ||
name: guid(customRole.roleName, subscription().id) | ||
properties: { | ||
assignableScopes: union(assignableScope.outputs.assignableScopes,[subscriptionId]) | ||
description: customRole.roleDescription | ||
permissions: [ | ||
{ | ||
actions: customRole.roleActions | ||
notActions: [] | ||
} | ||
] | ||
roleName: customRole.roleName | ||
type: 'CustomRole' | ||
} | ||
} | ||
|
||
output customRoleDefinitionId string = modifyExistingCustomRoleDefinition.id |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
targetScope = 'subscription' | ||
|
||
/* | ||
This Bicep template defines the required permissions at Azure Subscription scope to enable CrowdStrike | ||
Indicator of Misconfiguration (IOM) | ||
Copyright (c) 2024 CrowdStrike, Inc. | ||
*/ | ||
|
||
var customRole = { | ||
roleName: 'cs-website-reader' | ||
roleDescription: 'CrowdStrike custom role to allow read access to App Service and Function.' | ||
roleActions: [ | ||
'Microsoft.Web/sites/Read' | ||
'Microsoft.Web/sites/config/Read' | ||
'Microsoft.Web/sites/config/list/Action' | ||
] | ||
} | ||
|
||
resource customRoleDefinition 'Microsoft.Authorization/roleDefinitions@2022-04-01' = { | ||
name: guid(customRole.roleName, subscription().id,'test') | ||
properties: { | ||
assignableScopes: [subscription().id] | ||
description: customRole.roleDescription | ||
permissions: [ | ||
{ | ||
actions: customRole.roleActions | ||
notActions: [] | ||
} | ||
] | ||
roleName: customRole.roleName | ||
type: 'CustomRole' | ||
} | ||
} | ||
|
||
output customRoleDefinitionId string = customRoleDefinition.id |