Skip to content

Commit

Permalink
Rename tests clean up metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbud committed May 9, 2024
1 parent 130d7ca commit 2aecd08
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
14 changes: 9 additions & 5 deletions avm/ptn/authorization/resource-role-assignment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The following section provides usage examples for the module, which were used to

### Example 1: _Resource Role Assignments_

This module deploys a Resource Role Assignment using minimal parameters.
This module deploys a Resource Role Assignment using all parameters.


<details>
Expand All @@ -46,8 +46,9 @@ module resourceRoleAssignment 'br/public:avm/ptn/authorization/resource-role-ass
resourceId: '<resourceId>'
roleDefinitionId: '2a2b9908-6ea1-4ae2-8e65-a410df84e7d1'
// Non-required parameters
enableTelemetry: false
description: 'Assign Storage Blob Data Reader role to the managed identity on the storage account.'
principalType: 'ServicePrincipal'
roleName: 'Storage Blob Data Reader'
}
}
```
Expand Down Expand Up @@ -78,11 +79,14 @@ module resourceRoleAssignment 'br/public:avm/ptn/authorization/resource-role-ass
"value": "2a2b9908-6ea1-4ae2-8e65-a410df84e7d1"
},
// Non-required parameters
"enableTelemetry": {
"value": false
"description": {
"value": "Assign Storage Blob Data Reader role to the managed identity on the storage account."
},
"principalType": {
"value": "ServicePrincipal"
},
"roleName": {
"value": "Storage Blob Data Reader"
}
}
}
Expand All @@ -93,7 +97,7 @@ module resourceRoleAssignment 'br/public:avm/ptn/authorization/resource-role-ass

### Example 2: _Resource Role Assignments_

This module deploys a Role Assignment at a Resource scope using common parameters.
This module deploys a Resource Role Assignment using minimal parameters.


<details>
Expand Down
33 changes: 16 additions & 17 deletions avm/ptn/authorization/resource-role-assignment/main.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.170.59819",
"templateHash": "15111475392680889649"
"templateHash": "9912378437381690323"
},
"name": "ResourceRole Assignments (All scopes)",
"description": "This module deploys a Role Assignment for a specific resource.",
Expand All @@ -27,7 +27,7 @@
"roleDefinitionId": {
"type": "string",
"metadata": {
"description": "Required. You can provide the role definition as a fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11'."
"description": "Required. The role definition ID for the role assignment."
}
},
"roleName": {
Expand Down Expand Up @@ -65,13 +65,6 @@
"description": "Optional. The Description of role assignment."
}
},
"location": {
"type": "string",
"defaultValue": "[deployment().location]",
"metadata": {
"description": "Optional. Location deployment metadata."
}
},
"enableTelemetry": {
"type": "bool",
"defaultValue": true,
Expand Down Expand Up @@ -123,7 +116,7 @@
"scope": "[[parameters('scope')]",
"name": "[[parameters('name')]",
"properties": {
"roleDefinitionId": "[[resourceId('Microsoft.Authorization/roleDefinitions', parameters('roleDefinitionId'))]",
"roleDefinitionId": "[[parameters('roleDefinitionId')]",
"principalId": "[[parameters('principalId')]",
"principalType": "[[parameters('principalType')]",
"description": "[[parameters('description')]"
Expand All @@ -143,7 +136,7 @@
"condition": "[parameters('enableTelemetry')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2023-07-01",
"name": "[format('46d3xbcp.ptn.authorization-resourceroleassignment.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"name": "[format('46d3xbcp.ptn.authorization-resourceroleassignment.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name), 0, 4))]",
"properties": {
"mode": "Incremental",
"template": {
Expand All @@ -157,13 +150,12 @@
}
}
}
},
"location": "[parameters('location')]"
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2023-07-01",
"name": "[take(format('rra-{0}-{1}', parameters('name'), last(split(parameters('resourceId'), '/'))), 64)]",
"name": "[format('{0}-ResourceRoleAssignment', guid(parameters('resourceId'), parameters('roleDefinitionId')))]",
"properties": {
"mode": "Incremental",
"expressionEvaluationOptions": {
Expand All @@ -178,7 +170,7 @@
"value": "[parameters('name')]"
},
"roleDefinitionId": {
"value": "[parameters('roleDefinitionId')]"
"value": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', parameters('roleDefinitionId'))]"
},
"principalId": {
"value": "[parameters('principalId')]"
Expand Down Expand Up @@ -213,7 +205,14 @@
"metadata": {
"description": "The resource ID of the Role Assignment."
},
"value": "[reference(subscriptionResourceId('Microsoft.Resources/deployments', take(format('rra-{0}-{1}', parameters('name'), last(split(parameters('resourceId'), '/'))), 64)), '2023-07-01').outputs.roleAssignmentId.value]"
"value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-ResourceRoleAssignment', guid(parameters('resourceId'), parameters('roleDefinitionId')))), '2023-07-01').outputs.roleAssignmentId.value]"
},
"resourceGroupName": {
"type": "string",
"metadata": {
"description": "The name of the resource group the role assignment was applied at."
},
"value": "[resourceGroup().name]"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
targetScope = 'subscription'
metadata name = 'Resource Role Assignments'
metadata description = 'This module deploys a Role Assignment at a Resource scope using common parameters.'
metadata description = 'This module deploys a Resource Role Assignment using all parameters.'

// ========== //
// Parameters //
Expand All @@ -14,7 +14,7 @@ param resourceGroupName string = 'dep-${namePrefix}-authorization.resourceroleas
param resourceLocation string = deployment().location

@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.')
param serviceShort string = 'arrawaf'
param serviceShort string = 'arraall'

@description('Optional. A token to inject into the name of each resource. This value can be automatically injected by the CI.')
param namePrefix string = '#_namePrefix_#'
Expand Down Expand Up @@ -52,12 +52,14 @@ module testDeployment '../../../main.bicep' = [
params: {
name: guid(
nestedDependencies.outputs.managedIdentityPrincipalId,
nestedDependencies.outputs.storageAccountResourceId,
nestedDependencies.outputs.storageAccountResourceId
)
resourceId: nestedDependencies.outputs.storageAccountResourceId
principalId: nestedDependencies.outputs.managedIdentityPrincipalId
principalType: 'ServicePrincipal'
roleDefinitionId: '2a2b9908-6ea1-4ae2-8e65-a410df84e7d1' // Storage Blob Data Reader
roleDefinitionId: '2a2b9908-6ea1-4ae2-8e65-a410df84e7d1'
roleName: 'Storage Blob Data Reader'
description: 'Assign Storage Blob Data Reader role to the managed identity on the storage account.'
}
}
]

0 comments on commit 2aecd08

Please sign in to comment.