Skip to content

Commit 2c0ffd9

Browse files
Updated Bicep, Azure CLI script, link to GitHub
I updated the following: - Bicep code, especially role assignments - Removed role from "Create a service principal for the new Azure AD application" as when specifying a role without a scope, the `az ad sp create-for-rbac` command throws an exception - Changed the link to the ARO GitHub repo as in the current version the article points to the Azure Container Apps repo. ------- cc: @johnmarco
1 parent e43a060 commit 2c0ffd9

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

articles/openshift/quickstart-openshift-arm-bicep-template.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,10 @@ param aadClientSecret string
453453
@description('The ObjectID of the Resource Provider Service Principal')
454454
param rpObjectId string
455455
456-
var contribRole = '/subscriptions/${subscription().subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c'
456+
var contributorRoleDefinitionId = resourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')
457+
var resourceGroupId = '/subscriptions/${subscription().subscriptionId}/resourceGroups/aro-${domain}-${location}'
458+
var masterSubnetId=resourceId('Microsoft.Network/virtualNetworks/subnets', clusterVnetName, 'master')
459+
var workerSubnetId=resourceId('Microsoft.Network/virtualNetworks/subnets', clusterVnetName, 'worker')
457460
458461
resource clusterVnetName_resource 'Microsoft.Network/virtualNetworks@2020-05-01' = {
459462
name: clusterVnetName
@@ -493,26 +496,24 @@ resource clusterVnetName_resource 'Microsoft.Network/virtualNetworks@2020-05-01'
493496
}
494497
}
495498
496-
resource clusterVnetName_Microsoft_Authorization_id_name_aadObjectId 'Microsoft.Network/virtualNetworks/providers/roleAssignments@2018-09-01-preview' = {
497-
name: '${clusterVnetName}/Microsoft.Authorization/${guid(resourceGroup().id, deployment().name, aadObjectId)}'
499+
resource clusterVnetName_Microsoft_Authorization_id_name_aadObjectId 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = {
500+
name: guid(aadObjectId, clusterVnetName_resource.id, contributorRoleDefinitionId)
501+
scope: clusterVnetName_resource
498502
properties: {
499-
roleDefinitionId: contribRole
503+
roleDefinitionId: contributorRoleDefinitionId
500504
principalId: aadObjectId
505+
principalType: 'ServicePrincipal'
501506
}
502-
dependsOn: [
503-
clusterVnetName_resource
504-
]
505507
}
506508
507-
resource clusterVnetName_Microsoft_Authorization_id_name_rpObjectId 'Microsoft.Network/virtualNetworks/providers/roleAssignments@2018-09-01-preview' = {
508-
name: '${clusterVnetName}/Microsoft.Authorization/${guid(resourceGroup().id, deployment().name, rpObjectId)}'
509+
resource clusterVnetName_Microsoft_Authorization_id_name_rpObjectId 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = {
510+
name: guid(rpObjectId, clusterVnetName_resource.id, contributorRoleDefinitionId)
511+
scope: clusterVnetName_resource
509512
properties: {
510-
roleDefinitionId: contribRole
513+
roleDefinitionId: contributorRoleDefinitionId
511514
principalId: rpObjectId
515+
principalType: 'ServicePrincipal'
512516
}
513-
dependsOn: [
514-
clusterVnetName_resource
515-
]
516517
}
517518
518519
resource clusterName_resource 'Microsoft.RedHatOpenShift/OpenShiftClusters@2020-04-30' = {
@@ -522,7 +523,7 @@ resource clusterName_resource 'Microsoft.RedHatOpenShift/OpenShiftClusters@2020-
522523
properties: {
523524
clusterProfile: {
524525
domain: domain
525-
resourceGroupId: '/subscriptions/${subscription().subscriptionId}/resourceGroups/aro-${domain}-${location}'
526+
resourceGroupId: resourceGroupId
526527
pullSecret: pullSecret
527528
}
528529
networkProfile: {
@@ -535,14 +536,14 @@ resource clusterName_resource 'Microsoft.RedHatOpenShift/OpenShiftClusters@2020-
535536
}
536537
masterProfile: {
537538
vmSize: masterVmSize
538-
subnetId: resourceId('Microsoft.Network/virtualNetworks/subnets', clusterVnetName, 'master')
539+
subnetId: masterSubnetId
539540
}
540541
workerProfiles: [
541542
{
542543
name: 'worker'
543544
vmSize: workerVmSize
544545
diskSizeGB: workerVmDiskSize
545-
subnetId: resourceId('Microsoft.Network/virtualNetworks/subnets', clusterVnetName, 'worker')
546+
subnetId: workerSubnetId
546547
count: workerCount
547548
}
548549
]
@@ -754,7 +755,7 @@ az group create --name $RESOURCEGROUP --location $LOCATION
754755
- Azure CLI
755756

756757
```azurecli-interactive
757-
az ad sp create-for-rbac --name "sp-$RG_NAME-${RANDOM}" --role Contributor > app-service-principal.json
758+
az ad sp create-for-rbac --name "sp-$RG_NAME-${RANDOM}" > app-service-principal.json
758759
SP_CLIENT_ID=$(jq -r '.appId' app-service-principal.json)
759760
SP_CLIENT_SECRET=$(jq -r '.password' app-service-principal.json)
760761
SP_OBJECT_ID=$(az ad sp show --id $SP_CLIENT_ID | jq -r '.id')
@@ -812,7 +813,7 @@ az aro delete --resource-group $RESOURCEGROUP --name $ARO_CLUSTER_NAME
812813
```
813814

814815
> [!TIP]
815-
> Having issues? Let us know on GitHub by opening an issue in the [Azure Container Apps repo](https://github.com/microsoft/azure-container-apps).
816+
> Having issues? Let us know on GitHub by opening an issue in the [Azure Red Hat Openshift (ARO) repo](https://github.com/Azure/OpenShift).
816817
817818
## Next steps
818819

0 commit comments

Comments
 (0)