diff --git a/.github/workflows/ms.authorization.roledefinitions.yml b/.github/workflows/ms.authorization.roledefinitions.yml index d4f169b1fb..957107deb5 100644 --- a/.github/workflows/ms.authorization.roledefinitions.yml +++ b/.github/workflows/ms.authorization.roledefinitions.yml @@ -109,8 +109,7 @@ jobs: - name: 'Using test file [${{ matrix.moduleTestFilePaths }}]' uses: ./.github/actions/templates/validateModuleDeployment with: - templateFilePath: '${{ env.modulePath }}/deploy.bicep' - parameterFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}' + templateFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}' location: '${{ env.location }}' resourceGroupName: '${{ env.resourceGroupName }}' subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/mg.common/deploy.test.bicep b/modules/Microsoft.Authorization/roleDefinitions/.test/mg.common/deploy.test.bicep new file mode 100644 index 0000000000..2803a12203 --- /dev/null +++ b/modules/Microsoft.Authorization/roleDefinitions/.test/mg.common/deploy.test.bicep @@ -0,0 +1,31 @@ +targetScope = 'managementGroup' + +// ========== // +// Parameters // +// ========== // +@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 = 'ardmgcom' + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../managementGroup/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + roleName: '<>-testRole-${serviceShort}' + actions: [ + 'Microsoft.Compute/galleries/*' + 'Microsoft.Network/virtualNetworks/read' + ] + assignableScopes: [ + managementGroup().id + ] + description: 'Test Custom Role Definition Standard (management group scope)' + notActions: [ + 'Microsoft.Compute/images/delete' + 'Microsoft.Compute/images/write' + 'Microsoft.Network/virtualNetworks/subnets/join/action' + ] + } +} diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/mg.min.parameters.json b/modules/Microsoft.Authorization/roleDefinitions/.test/mg.min.parameters.json deleted file mode 100644 index c4a88ba9e8..0000000000 --- a/modules/Microsoft.Authorization/roleDefinitions/.test/mg.min.parameters.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "roleName": { - "value": "<>-az-testRole-mg-min" - }, - "actions": { - "value": [ - "Microsoft.Compute/galleries/read", - "Microsoft.Compute/galleries/images/read" - ] - } - } -} diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/mg.min/deploy.test.bicep b/modules/Microsoft.Authorization/roleDefinitions/.test/mg.min/deploy.test.bicep new file mode 100644 index 0000000000..ae775efdd0 --- /dev/null +++ b/modules/Microsoft.Authorization/roleDefinitions/.test/mg.min/deploy.test.bicep @@ -0,0 +1,22 @@ +targetScope = 'managementGroup' + +// ========== // +// Parameters // +// ========== // +@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 = 'ardmgmin' + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../managementGroup/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + roleName: '<>-testRole-${serviceShort}' + actions: [ + 'Microsoft.Compute/galleries/images/read' + 'Microsoft.Compute/galleries/read' + ] + } +} diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/mg.parameters.json b/modules/Microsoft.Authorization/roleDefinitions/.test/mg.parameters.json deleted file mode 100644 index d49ce1cae3..0000000000 --- a/modules/Microsoft.Authorization/roleDefinitions/.test/mg.parameters.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "roleName": { - "value": "<>-az-testRole-mg" - }, - "description": { - "value": "Test Custom Role Definition Standard (management group scope)" - }, - "actions": { - "value": [ - "Microsoft.Compute/galleries/*", - "Microsoft.Network/virtualNetworks/read" - ] - }, - "notActions": { - "value": [ - "Microsoft.Compute/images/write", - "Microsoft.Compute/images/delete", - "Microsoft.Network/virtualNetworks/subnets/join/action" - ] - }, - "dataActions": { - "value": [ - "Microsoft.Storage/storageAccounts/blobServices/*/read" - ] - }, - "notDataActions": { - "value": [ - "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read" - ] - }, - "assignableScopes": { - "value": [ - "/providers/Microsoft.Management/managementGroups/<>" - ] - }, - "managementGroupId": { - "value": "<>" - } - } -} diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/rg.common/deploy.test.bicep b/modules/Microsoft.Authorization/roleDefinitions/.test/rg.common/deploy.test.bicep new file mode 100644 index 0000000000..e4004b87fe --- /dev/null +++ b/modules/Microsoft.Authorization/roleDefinitions/.test/rg.common/deploy.test.bicep @@ -0,0 +1,56 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes.') +@maxLength(90) +param resourceGroupName string = 'ms.authorization.roledefinitions-${serviceShort}-rg' + +@description('Optional. The location to deploy resources to.') +param location 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 = 'ardrgcom' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../resourceGroup/deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + roleName: '<>-testRole-${serviceShort}' + actions: [ + 'Microsoft.Compute/galleries/*' + 'Microsoft.Network/virtualNetworks/read' + ] + assignableScopes: [ + resourceGroup.id + ] + dataActions: [ + 'Microsoft.Storage/storageAccounts/blobServices/*/read' + ] + description: 'Test Custom Role Definition Standard (resource group scope)' + notActions: [ + 'Microsoft.Compute/images/delete' + 'Microsoft.Compute/images/write' + 'Microsoft.Network/virtualNetworks/subnets/join/action' + ] + notDataActions: [ + 'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read' + ] + } +} diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/rg.min.parameters.json b/modules/Microsoft.Authorization/roleDefinitions/.test/rg.min.parameters.json deleted file mode 100644 index cf6825cc02..0000000000 --- a/modules/Microsoft.Authorization/roleDefinitions/.test/rg.min.parameters.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "roleName": { - "value": "<>-az-testRole-rg-min" - }, - "actions": { - "value": [ - "Microsoft.Compute/galleries/read", - "Microsoft.Compute/galleries/images/read" - ] - }, - "subscriptionId": { - "value": "<>" - }, - "resourceGroupName": { - "value": "<>" - } - } -} diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/rg.min/deploy.test.bicep b/modules/Microsoft.Authorization/roleDefinitions/.test/rg.min/deploy.test.bicep new file mode 100644 index 0000000000..905c662c79 --- /dev/null +++ b/modules/Microsoft.Authorization/roleDefinitions/.test/rg.min/deploy.test.bicep @@ -0,0 +1,41 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes.') +@maxLength(90) +param resourceGroupName string = 'ms.authorization.roledefinitions-${serviceShort}-rg' + +@description('Optional. The location to deploy resources to.') +param location 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 = 'ardrgmin' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../resourceGroup/deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + roleName: '<>-testRole-${serviceShort}' + actions: [ + 'Microsoft.Compute/galleries/images/read' + 'Microsoft.Compute/galleries/read' + ] + } +} diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/rg.parameters.json b/modules/Microsoft.Authorization/roleDefinitions/.test/rg.parameters.json deleted file mode 100644 index c27ff2f862..0000000000 --- a/modules/Microsoft.Authorization/roleDefinitions/.test/rg.parameters.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "roleName": { - "value": "<>-az-testRole-rg" - }, - "description": { - "value": "Test Custom Role Definition Standard (resource group scope)" - }, - "actions": { - "value": [ - "Microsoft.Compute/galleries/*", - "Microsoft.Network/virtualNetworks/read" - ] - }, - "notActions": { - "value": [ - "Microsoft.Compute/images/write", - "Microsoft.Compute/images/delete", - "Microsoft.Network/virtualNetworks/subnets/join/action" - ] - }, - "dataActions": { - "value": [ - "Microsoft.Storage/storageAccounts/blobServices/*/read" - ] - }, - "notDataActions": { - "value": [ - "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read" - ] - }, - "assignableScopes": { - "value": [ - "/subscriptions/<>/resourceGroups/<>" - ] - }, - "subscriptionId": { - "value": "<>" - }, - "resourceGroupName": { - "value": "<>" - } - } -} diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/sub.common/deploy.test.bicep b/modules/Microsoft.Authorization/roleDefinitions/.test/sub.common/deploy.test.bicep new file mode 100644 index 0000000000..e9bb5500fb --- /dev/null +++ b/modules/Microsoft.Authorization/roleDefinitions/.test/sub.common/deploy.test.bicep @@ -0,0 +1,37 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@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 = 'ardsubcom' + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../subscription/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + roleName: '<>-testRole-${serviceShort}' + actions: [ + 'Microsoft.Compute/galleries/*' + 'Microsoft.Network/virtualNetworks/read' + ] + assignableScopes: [ + subscription().id + ] + dataActions: [ + 'Microsoft.Storage/storageAccounts/blobServices/*/read' + ] + description: 'Test Custom Role Definition Standard (subscription scope)' + notActions: [ + 'Microsoft.Compute/images/delete' + 'Microsoft.Compute/images/write' + 'Microsoft.Network/virtualNetworks/subnets/join/action' + ] + notDataActions: [ + 'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read' + ] + } +} diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/sub.min.parameters.json b/modules/Microsoft.Authorization/roleDefinitions/.test/sub.min.parameters.json deleted file mode 100644 index 87bbbc20b7..0000000000 --- a/modules/Microsoft.Authorization/roleDefinitions/.test/sub.min.parameters.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "roleName": { - "value": "<>-az-testRole-sub-min" - }, - "actions": { - "value": [ - "Microsoft.Compute/galleries/read", - "Microsoft.Compute/galleries/images/read" - ] - }, - "subscriptionId": { - "value": "<>" - } - } -} diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/sub.min/deploy.test.bicep b/modules/Microsoft.Authorization/roleDefinitions/.test/sub.min/deploy.test.bicep new file mode 100644 index 0000000000..a07bf12786 --- /dev/null +++ b/modules/Microsoft.Authorization/roleDefinitions/.test/sub.min/deploy.test.bicep @@ -0,0 +1,23 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@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 = 'ardsubmin' + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../subscription/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + roleName: '<>-testRole-${serviceShort}' + actions: [ + 'Microsoft.Compute/galleries/images/read' + 'Microsoft.Compute/galleries/read' + ] + subscriptionId: subscription().subscriptionId + } +} diff --git a/modules/Microsoft.Authorization/roleDefinitions/.test/sub.parameters.json b/modules/Microsoft.Authorization/roleDefinitions/.test/sub.parameters.json deleted file mode 100644 index 62e03ca98d..0000000000 --- a/modules/Microsoft.Authorization/roleDefinitions/.test/sub.parameters.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "roleName": { - "value": "<>-az-testRole-sub" - }, - "description": { - "value": "Test Custom Role Definition Standard (subscription scope)" - }, - "actions": { - "value": [ - "Microsoft.Compute/galleries/*", - "Microsoft.Network/virtualNetworks/read" - ] - }, - "notActions": { - "value": [ - "Microsoft.Compute/images/write", - "Microsoft.Compute/images/delete", - "Microsoft.Network/virtualNetworks/subnets/join/action" - ] - }, - "dataActions": { - "value": [ - "Microsoft.Storage/storageAccounts/blobServices/*/read" - ] - }, - "notDataActions": { - "value": [ - "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read" - ] - }, - "assignableScopes": { - "value": [ - "/subscriptions/<>" - ] - }, - "subscriptionId": { - "value": "<>" - } - } -} diff --git a/modules/Microsoft.Authorization/roleDefinitions/readme.md b/modules/Microsoft.Authorization/roleDefinitions/readme.md index 6b55fbdd11..bc1f4fde5d 100644 --- a/modules/Microsoft.Authorization/roleDefinitions/readme.md +++ b/modules/Microsoft.Authorization/roleDefinitions/readme.md @@ -181,7 +181,7 @@ The following module usage examples are retrieved from the content of the files >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. -

Example 1: Mg Min

+

Example 1: Mg.Common

@@ -189,82 +189,24 @@ The following module usage examples are retrieved from the content of the files ```bicep module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-RoleDefinitions' + name: '${uniqueString(deployment().name)}-test-ardmgcom' params: { // Required parameters - roleName: '<>-az-testRole-mg-min' - // Non-required parameters - actions: [ - 'Microsoft.Compute/galleries/images/read' - 'Microsoft.Compute/galleries/read' - ] - } -} -``` - -
-

- -

- -via JSON Parameter file - -```json -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - // Required parameters - "roleName": { - "value": "<>-az-testRole-mg-min" - }, - // Non-required parameters - "actions": { - "value": [ - "Microsoft.Compute/galleries/images/read", - "Microsoft.Compute/galleries/read" - ] - } - } -} -``` - -
-

- -

Example 2: Mg

- -
- -via Bicep module - -```bicep -module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-RoleDefinitions' - params: { - // Required parameters - roleName: '<>-az-testRole-mg' + roleName: '<>-testRole-ardmgcom' // Non-required parameters actions: [ 'Microsoft.Compute/galleries/*' 'Microsoft.Network/virtualNetworks/read' ] assignableScopes: [ - '/providers/Microsoft.Management/managementGroups/<>' - ] - dataActions: [ - 'Microsoft.Storage/storageAccounts/blobServices/*/read' + '' ] description: 'Test Custom Role Definition Standard (management group scope)' - managementGroupId: '<>' notActions: [ 'Microsoft.Compute/images/delete' 'Microsoft.Compute/images/write' 'Microsoft.Network/virtualNetworks/subnets/join/action' ] - notDataActions: [ - 'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read' - ] } } ``` @@ -283,7 +225,7 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' "parameters": { // Required parameters "roleName": { - "value": "<>-az-testRole-mg" + "value": "<>-testRole-ardmgcom" }, // Non-required parameters "actions": { @@ -294,31 +236,18 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' }, "assignableScopes": { "value": [ - "/providers/Microsoft.Management/managementGroups/<>" - ] - }, - "dataActions": { - "value": [ - "Microsoft.Storage/storageAccounts/blobServices/*/read" + "" ] }, "description": { "value": "Test Custom Role Definition Standard (management group scope)" }, - "managementGroupId": { - "value": "<>" - }, "notActions": { "value": [ "Microsoft.Compute/images/delete", "Microsoft.Compute/images/write", "Microsoft.Network/virtualNetworks/subnets/join/action" ] - }, - "notDataActions": { - "value": [ - "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read" - ] } } } @@ -327,7 +256,7 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep'

-

Example 3: Rg Min

+

Example 2: Mg.Min

@@ -335,17 +264,15 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' ```bicep module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-RoleDefinitions' + name: '${uniqueString(deployment().name)}-test-ardmgmin' params: { // Required parameters - roleName: '<>-az-testRole-rg-min' + roleName: '<>-testRole-ardmgmin' // Non-required parameters actions: [ 'Microsoft.Compute/galleries/images/read' 'Microsoft.Compute/galleries/read' ] - resourceGroupName: '<>' - subscriptionId: '<>' } } ``` @@ -364,7 +291,7 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' "parameters": { // Required parameters "roleName": { - "value": "<>-az-testRole-rg-min" + "value": "<>-testRole-ardmgmin" }, // Non-required parameters "actions": { @@ -372,12 +299,6 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' "Microsoft.Compute/galleries/images/read", "Microsoft.Compute/galleries/read" ] - }, - "resourceGroupName": { - "value": "<>" - }, - "subscriptionId": { - "value": "<>" } } } @@ -386,7 +307,7 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep'

-

Example 4: Rg

+

Example 3: Rg.Common

@@ -394,17 +315,17 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' ```bicep module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-RoleDefinitions' + name: '${uniqueString(deployment().name)}-test-ardrgcom' params: { // Required parameters - roleName: '<>-az-testRole-rg' + roleName: '<>-testRole-ardrgcom' // Non-required parameters actions: [ 'Microsoft.Compute/galleries/*' 'Microsoft.Network/virtualNetworks/read' ] assignableScopes: [ - '/subscriptions/<>/resourceGroups/<>' + '' ] dataActions: [ 'Microsoft.Storage/storageAccounts/blobServices/*/read' @@ -418,8 +339,6 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' notDataActions: [ 'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read' ] - resourceGroupName: '<>' - subscriptionId: '<>' } } ``` @@ -438,7 +357,7 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' "parameters": { // Required parameters "roleName": { - "value": "<>-az-testRole-rg" + "value": "<>-testRole-ardrgcom" }, // Non-required parameters "actions": { @@ -449,7 +368,7 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' }, "assignableScopes": { "value": [ - "/subscriptions/<>/resourceGroups/<>" + "" ] }, "dataActions": { @@ -471,12 +390,6 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' "value": [ "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read" ] - }, - "resourceGroupName": { - "value": "<>" - }, - "subscriptionId": { - "value": "<>" } } } @@ -485,7 +398,7 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep'

-

Example 5: Sub Min

+

Example 4: Rg.Min

@@ -493,16 +406,15 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' ```bicep module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-RoleDefinitions' + name: '${uniqueString(deployment().name)}-test-ardrgmin' params: { // Required parameters - roleName: '<>-az-testRole-sub-min' + roleName: '<>-testRole-ardrgmin' // Non-required parameters actions: [ 'Microsoft.Compute/galleries/images/read' 'Microsoft.Compute/galleries/read' ] - subscriptionId: '<>' } } ``` @@ -521,7 +433,7 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' "parameters": { // Required parameters "roleName": { - "value": "<>-az-testRole-sub-min" + "value": "<>-testRole-ardrgmin" }, // Non-required parameters "actions": { @@ -529,9 +441,6 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' "Microsoft.Compute/galleries/images/read", "Microsoft.Compute/galleries/read" ] - }, - "subscriptionId": { - "value": "<>" } } } @@ -540,7 +449,7 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep'

-

Example 6: Sub

+

Example 5: Sub.Common

@@ -548,17 +457,17 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' ```bicep module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-RoleDefinitions' + name: '${uniqueString(deployment().name)}-test-ardsubcom' params: { // Required parameters - roleName: '<>-az-testRole-sub' + roleName: '<>-testRole-ardsubcom' // Non-required parameters actions: [ 'Microsoft.Compute/galleries/*' 'Microsoft.Network/virtualNetworks/read' ] assignableScopes: [ - '/subscriptions/<>' + '' ] dataActions: [ 'Microsoft.Storage/storageAccounts/blobServices/*/read' @@ -572,7 +481,6 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' notDataActions: [ 'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read' ] - subscriptionId: '<>' } } ``` @@ -591,7 +499,7 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' "parameters": { // Required parameters "roleName": { - "value": "<>-az-testRole-sub" + "value": "<>-testRole-ardsubcom" }, // Non-required parameters "actions": { @@ -602,7 +510,7 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' }, "assignableScopes": { "value": [ - "/subscriptions/<>" + "" ] }, "dataActions": { @@ -624,9 +532,61 @@ module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' "value": [ "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read" ] + } + } +} +``` + +
+

+ +

Example 6: Sub.Min

+ +
+ +via Bicep module + +```bicep +module roleDefinitions './Microsoft.Authorization/roleDefinitions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-ardsubmin' + params: { + // Required parameters + roleName: '<>-testRole-ardsubmin' + // Non-required parameters + actions: [ + 'Microsoft.Compute/galleries/images/read' + 'Microsoft.Compute/galleries/read' + ] + subscriptionId: '' + } +} +``` + +
+

+ +

+ +via JSON Parameter file + +```json +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + // Required parameters + "roleName": { + "value": "<>-testRole-ardsubmin" + }, + // Non-required parameters + "actions": { + "value": [ + "Microsoft.Compute/galleries/images/read", + "Microsoft.Compute/galleries/read" + ] }, "subscriptionId": { - "value": "<>" + "value": "" } } }