Skip to content

Commit 24f2f66

Browse files
edburnsgaliacheng
andauthored
Assign the Network Contributor role to AGIC to allow access to the existing virtual network (#349)
* Update WebLogic AKS version and add AGIC network contributor role assignment * Add scope to agicNetworkContributorRoleAssignment for resource group * Remove unused vnetRgName parameter from agicNetworkContributorRoleAssignment module --------- Co-authored-by: galiacheng <[email protected]>
1 parent 3204889 commit 24f2f66

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<properties>
4141
<!-- versions start -->
4242
<!-- weblogic azure aks versions -->
43-
<version.wls-on-aks-azure-marketplace>1.0.88</version.wls-on-aks-azure-marketplace>
43+
<version.wls-on-aks-azure-marketplace>1.0.89</version.wls-on-aks-azure-marketplace>
4444
<!-- weblogic azure vm versions -->
4545
<version.arm-oraclelinux-wls>1.0.31</version.arm-oraclelinux-wls>
4646
<version.arm-oraclelinux-wls-admin>1.0.56</version.arm-oraclelinux-wls-admin>

weblogic-azure-aks/src/main/bicep/mainTemplate.bicep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,8 @@ module networkingDeployment 'modules/networking.bicep' = if (const_enableNetwork
637637
identity: obj_uamiForDeploymentScript
638638
location: location
639639
lbSvcValues: lbSvcValues
640+
newOrExistingVnetForApplicationGateway: newOrExistingVnetForApplicationGateway
641+
vnetRGNameForApplicationGateway: vnetRGNameForApplicationGateway
640642
tagsByResource: _objTagsByResource
641643
useInternalLB: useInternalLB
642644
wlsDomainName: wlsDomainName
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
Copyright (c) 2021, 2024, Oracle and/or its affiliates.
3+
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
*/
5+
6+
param aksClusterName string
7+
param aksClusterRGName string
8+
param utcValue string = utcNow()
9+
10+
var const_APIVersion = '2020-12-01'
11+
var name_appGwContributorRoleAssignmentName = guid('${resourceGroup().id}${uniqueString(utcValue)}NetworkContributor')
12+
// https://docs.microsoft.com/en-us/azure/role-based-access-control/built-in-roles
13+
var const_roleDefinitionIdOfVnetContributor = '4d97b98b-1d4f-4787-a291-c67834d212e7'
14+
15+
resource aksCluster 'Microsoft.ContainerService/managedClusters@${azure.apiVersionForManagedClusters}' existing = {
16+
name: aksClusterName
17+
scope: resourceGroup(aksClusterRGName)
18+
}
19+
20+
resource agicUamiRoleAssignment 'Microsoft.Authorization/roleAssignments@${azure.apiVersionForRoleAssignment}' = {
21+
name: name_appGwContributorRoleAssignmentName
22+
properties: {
23+
description: 'Assign Network Contributor role to AGIC Identity '
24+
principalId: reference(aksCluster.id, const_APIVersion , 'Full').properties.addonProfiles.ingressApplicationGateway.identity.objectId
25+
principalType: 'ServicePrincipal'
26+
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', const_roleDefinitionIdOfVnetContributor)
27+
}
28+
dependsOn: [
29+
aksCluster
30+
]
31+
}

weblogic-azure-aks/src/main/bicep/modules/networking.bicep

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ param identity object = {}
4747
param location string
4848
@description('Object array to define Load Balancer service, each object must include service name, service target[admin-server or cluster-1], port.')
4949
param lbSvcValues array = []
50+
param newOrExistingVnetForApplicationGateway string
51+
param vnetRGNameForApplicationGateway string
5052
@description('${label.tagsLabel}')
5153
param tagsByResource object
5254
@description('True to set up internal load balancer service.')
@@ -124,6 +126,18 @@ module agicRoleAssignment '_rolesAssignment/_agicRoleAssignment.bicep' = if (ena
124126
]
125127
}
126128

129+
module agicNetworkContributorRoleAssignment '_rolesAssignment/_agicNetworkContributor.bicep' = if (enableAppGWIngress && newOrExistingVnetForApplicationGateway != 'new' && vnetRGNameForApplicationGateway != resourceGroup().name) {
130+
name: 'allow-agic-access-vnet'
131+
scope: resourceGroup(vnetRGNameForApplicationGateway)
132+
params: {
133+
aksClusterName: aksClusterName
134+
aksClusterRGName: aksClusterRGName
135+
}
136+
dependsOn: [
137+
installAgic
138+
]
139+
}
140+
127141
module validateAgic '_deployment-scripts/_ds_validate_agic.bicep' = if (enableAppGWIngress) {
128142
name: 'validate-agic'
129143
params: {

0 commit comments

Comments
 (0)