Skip to content

Commit 608a3cb

Browse files
committed
Changes for Outbound access for Dynamic Cluster Offer and Azure security fixes
1 parent eb12c37 commit 608a3cb

14 files changed

+429
-68
lines changed

weblogic-azure-vm/arm-oraclelinux-wls-dynamic-cluster/arm-oraclelinux-wls-dynamic-cluster/src/main/arm/mainTemplate.json

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@
191191
"description": "A unique value to ensure the generated names are unique."
192192
}
193193
},
194+
"guidTag": {
195+
"type": "string",
196+
"defaultValue": "[newGuid()]"
197+
},
194198
"hasDNSZones": {
195199
"type": "bool",
196200
"defaultValue": false,
@@ -524,14 +528,18 @@
524528
},
525529
"variables": {
526530
"const_globalResourceNameSuffix": "[uniqueString(parameters('guidValue'))]",
531+
"const_guidTag": "[uniqueString(parameters('guidTag'))]",
527532
"name_adminVM": "[concat(parameters('adminVMNamePrefix'), variables('const_globalResourceNameSuffix'), 'VM')]",
528533
"name_clusterCustomSSLTemplate": "clusterCustomSSLLinkedTemplate",
529534
"name_clusterCustomSSLLinkedTemplateName": "clusterCustomSSLTemplate.json",
530535
"name_clusterLinkedTemplateName": "clusterTemplate.json",
531536
"name_clusterTemplate": "clusterLinkedTemplate",
537+
"name_uamiForPostDeploymentScript" : "uamiForPostDeploymentScript",
532538
"name_coherenceTemplateName": "coherenceTemplate.json",
533539
"name_dbLinkedTemplateName": "dbTemplate.json",
534540
"name_dnszonesLinkedTemplateName": "dnszonesTemplate.json",
541+
"name_postDeploymentUAMIRolesTemplate" : "postDeploymentUAMIRolesTemplate.json",
542+
"name_postDeploymentTemplate": "postDeploymentTemplate.json",
535543
"name_managedVMNamePrefix": "[concat(parameters('managedServerPrefix'), variables('const_globalResourceNameSuffix'))]",
536544
"name_networkSecurityGroup": "[concat(parameters('dnsLabelPrefix'), '-nsg-', variables('const_globalResourceNameSuffix'))]",
537545
"name_nsgLinkedTemplateName": "nsgNestedTemplate.json",
@@ -574,6 +582,9 @@
574582
"_globalResourceNameSuffix": {
575583
"value": "[variables('const_globalResourceNameSuffix')]"
576584
},
585+
"const_guidTag":{
586+
"value": "[variables('const_guidTag')]"
587+
},
577588
"adminPasswordOrKey": {
578589
"value": "[parameters('adminPasswordOrKey')]"
579590
},
@@ -682,6 +693,9 @@
682693
"_globalResourceNameSuffix": {
683694
"value": "[variables('const_globalResourceNameSuffix')]"
684695
},
696+
"const_guidTag":{
697+
"value": "[variables('const_guidTag')]"
698+
},
685699
"adminPasswordOrKey": {
686700
"value": "[parameters('adminPasswordOrKey')]"
687701
},
@@ -1270,7 +1284,8 @@
12701284
{
12711285
"type": "Microsoft.Resources/deployments",
12721286
"apiVersion": "${azure.apiVersionForDeployment}",
1273-
"name": "${dynamic.end}",
1287+
"name": "[variables('name_uamiForPostDeploymentScript')]",
1288+
"condition": "[equals(parameters('virtualNetworkNewOrExisting'), 'existing')]",
12741289
"dependsOn": [
12751290
"[resourceId('Microsoft.Resources/deployments', variables('ref_clusterTemplate'))]",
12761291
"[resourceId('Microsoft.Resources/deployments', 'dbLinkedTemplate')]",
@@ -1280,6 +1295,80 @@
12801295
"[resourceId('Microsoft.Resources/deployments', 'dnszonesLinkedTemplate')]",
12811296
"[resourceId('Microsoft.Resources/deployments', 'networkSecurityLinkedTemplate')]"
12821297
],
1298+
"properties": {
1299+
"mode": "Incremental",
1300+
"templateLink": {
1301+
"uri": "[uri(parameters('_artifactsLocation'), concat('nestedtemplates/', variables('name_postDeploymentUAMIRolesTemplate')))]",
1302+
"contentVersion": "1.0.0.0"
1303+
},
1304+
"parameters": {
1305+
"location": {
1306+
"value": "[parameters('location')]"
1307+
},
1308+
"_globalResourceNameSuffix": {
1309+
"value": "[variables('const_globalResourceNameSuffix')]"
1310+
}
1311+
}
1312+
}
1313+
},
1314+
{
1315+
"type": "Microsoft.Resources/deployments",
1316+
"apiVersion": "${azure.apiVersionForDeployment}",
1317+
"name": "postDeplyment",
1318+
"condition": "[equals(parameters('virtualNetworkNewOrExisting'), 'existing')]",
1319+
"dependsOn": [
1320+
"[resourceId('Microsoft.Resources/deployments', variables('ref_clusterTemplate'))]",
1321+
"[resourceId('Microsoft.Resources/deployments', 'dbLinkedTemplate')]",
1322+
"[resourceId('Microsoft.Resources/deployments', 'coherenceTemplate')]",
1323+
"[resourceId('Microsoft.Resources/deployments', 'coherenceTemplateWithCustomSSL')]",
1324+
"[resourceId('Microsoft.Resources/deployments', 'ohsLinkedTemplate')]",
1325+
"[resourceId('Microsoft.Resources/deployments', 'dnszonesLinkedTemplate')]",
1326+
"[resourceId('Microsoft.Resources/deployments', 'networkSecurityLinkedTemplate')]",
1327+
"[resourceId('Microsoft.Resources/deployments', variables('name_uamiForPostDeploymentScript'))]"
1328+
],
1329+
"properties": {
1330+
"mode": "Incremental",
1331+
"templateLink": {
1332+
"uri": "[uri(parameters('_artifactsLocation'), concat('nestedtemplates/', variables('name_postDeploymentTemplate')))]",
1333+
"contentVersion": "1.0.0.0"
1334+
},
1335+
"parameters": {
1336+
"location": {
1337+
"value": "[parameters('location')]"
1338+
},
1339+
"_globalResourceNameSuffix": {
1340+
"value": "[variables('const_globalResourceNameSuffix')]"
1341+
},
1342+
"const_guidTag":{
1343+
"value": "[variables('const_guidTag')]"
1344+
},
1345+
"_artifactsLocation": {
1346+
"value": "[parameters('_artifactsLocation')]"
1347+
},
1348+
"_artifactsLocationSasToken": {
1349+
"value": "[parameters('_artifactsLocationSasToken')]"
1350+
},
1351+
"userAssignedIdentityResourceId":{
1352+
"value": "[reference(variables('name_uamiForPostDeploymentScript'),'${azure.apiVersionForDeployment}').outputs.uamidForPostDeployment.value]"
1353+
}
1354+
}
1355+
}
1356+
},
1357+
{
1358+
"type": "Microsoft.Resources/deployments",
1359+
"apiVersion": "${azure.apiVersionForDeployment}",
1360+
"name": "${dynamic.end}",
1361+
"dependsOn": [
1362+
"[resourceId('Microsoft.Resources/deployments', variables('ref_clusterTemplate'))]",
1363+
"[resourceId('Microsoft.Resources/deployments', 'dbLinkedTemplate')]",
1364+
"[resourceId('Microsoft.Resources/deployments', 'coherenceTemplate')]",
1365+
"[resourceId('Microsoft.Resources/deployments', 'coherenceTemplateWithCustomSSL')]",
1366+
"[resourceId('Microsoft.Resources/deployments', 'ohsLinkedTemplate')]",
1367+
"[resourceId('Microsoft.Resources/deployments', 'dnszonesLinkedTemplate')]",
1368+
"[resourceId('Microsoft.Resources/deployments', 'networkSecurityLinkedTemplate')]",
1369+
"[resourceId('Microsoft.Resources/deployments', variables('name_uamiForPostDeploymentScript'))]",
1370+
"[resourceId('Microsoft.Resources/deployments','postDeplyment')]"
1371+
],
12831372
"properties": {
12841373
"mode": "Incremental",
12851374
"template": {

weblogic-azure-vm/arm-oraclelinux-wls-dynamic-cluster/arm-oraclelinux-wls-dynamic-cluster/src/main/arm/nestedtemplates/clusterCustomSSLTemplate.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
"description": "A suffix to be appended to all resources created by this template."
2929
}
3030
},
31+
"const_guidTag" :{
32+
"type": "string",
33+
"metadata": {
34+
"description": "A unique tag for resources."
35+
}
36+
},
3137
"adminPasswordOrKey": {
3238
"type": "securestring",
3339
"metadata": {
@@ -128,7 +134,7 @@
128134
"owls-122140-jdk8-rhel87;Oracle:weblogic-122140-jdk8-rhel87:owls-122140-jdk8-rhel87;latest",
129135
"owls-122140-jdk8-rhel76;Oracle:weblogic-122140-jdk8-rhel76:owls-122140-jdk8-rhel76;latest",
130136
"owls-141100-jdk8-rhel76;Oracle:weblogic-141100-jdk8-rhel76:owls-141100-jdk8-rhel76;latest",
131-
"owls-141100-jdk11-rhel76;Oracle:weblogic-141100-jdk11-rhel76:owls-141100-jdk11-rhel76;latest",
137+
"owls-141100-jdk11-rhel76;Oracle:weblogic-141100-jdk11-rhel76:owls-141100-jdk11-rhel76;latest"
132138
],
133139
"metadata": {
134140
"description": "The Oracle Linux image with Weblogic and Java preinstalled. Semicolon separated string of Sku, URN, and Version"
@@ -493,7 +499,7 @@
493499
{
494500
"apiVersion": "${azure.apiVersionForPublicIPAddresses}",
495501
"type": "Microsoft.Network/publicIPAddresses",
496-
"condition": "[equals(parameters('virtualNetworkNewOrExisting'), 'new')]",
502+
"tags": "[if(equals(parameters('virtualNetworkNewOrExisting'), 'existing'),createObject(parameters('const_guidTag'),''),createObject())]",
497503
"name": "[if(equals(copyIndex(),0),concat(parameters('adminVMName'),variables('name_publicIPAddress')),concat(variables('const_managedVMPrefix'), copyIndex(),variables('name_publicIPAddress')))]",
498504
"location": "[parameters('location')]",
499505
"copy": {
@@ -578,20 +584,27 @@
578584
"count": "[add(parameters('dynamicClusterSize'),1)]"
579585
},
580586
"dependsOn": [
581-
"[variables('name_virtualNetwork')]"
587+
"[variables('name_virtualNetwork')]",
588+
"publicIPLoop"
582589
],
583590
"properties": {
584591
"ipConfigurations": [
585592
{
586593
"name": "ipconfig1",
587594
"properties": {
588595
"privateIPAllocationMethod": "Dynamic",
596+
"publicIPAddress": {
597+
"id": "[resourceId('Microsoft.Network/publicIPAddresses',if(equals(copyIndex(),0),concat(parameters('adminVMName'),variables('name_publicIPAddress')),concat(variables('const_managedVMPrefix'), copyIndex(),variables('name_publicIPAddress'))))]"
598+
},
589599
"subnet": {
590600
"id": "[variables('ref_subnet')]"
591601
}
592602
}
593603
}
594-
]
604+
],
605+
"dnsSettings": {
606+
"internalDnsNameLabel": "[if(equals(copyIndex(),0),parameters('adminVMName'),concat(variables('const_managedVMPrefix'), copyIndex()))]"
607+
}
595608
}
596609
},
597610
{

weblogic-azure-vm/arm-oraclelinux-wls-dynamic-cluster/arm-oraclelinux-wls-dynamic-cluster/src/main/arm/nestedtemplates/clusterTemplate.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
"description": "A suffix to be appended to all resources created by this template."
2929
}
3030
},
31+
"const_guidTag" :{
32+
"type": "string",
33+
"metadata": {
34+
"description": "A unique tag for resources."
35+
}
36+
},
3137
"adminPasswordOrKey": {
3238
"type": "securestring",
3339
"metadata": {
@@ -422,7 +428,7 @@
422428
{
423429
"apiVersion": "${azure.apiVersionForPublicIPAddresses}",
424430
"type": "Microsoft.Network/publicIPAddresses",
425-
"condition": "[equals(parameters('virtualNetworkNewOrExisting'), 'new')]",
431+
"tags": "[if(equals(parameters('virtualNetworkNewOrExisting'), 'existing'),createObject(parameters('const_guidTag'),''),createObject())]",
426432
"name": "[if(equals(copyIndex(),0),concat(parameters('adminVMName'),variables('name_publicIPAddress')),concat(variables('const_managedVMPrefix'), copyIndex(),variables('name_publicIPAddress')))]",
427433
"location": "[parameters('location')]",
428434
"copy": {
@@ -507,20 +513,27 @@
507513
"count": "[add(parameters('dynamicClusterSize'),1)]"
508514
},
509515
"dependsOn": [
510-
"[variables('name_virtualNetwork')]"
516+
"[variables('name_virtualNetwork')]",
517+
"publicIPLoop"
511518
],
512519
"properties": {
513520
"ipConfigurations": [
514521
{
515522
"name": "ipconfig1",
516523
"properties": {
517524
"privateIPAllocationMethod": "Dynamic",
525+
"publicIPAddress": {
526+
"id": "[resourceId('Microsoft.Network/publicIPAddresses',if(equals(copyIndex(),0),concat(parameters('adminVMName'),variables('name_publicIPAddress')),concat(variables('const_managedVMPrefix'), copyIndex(),variables('name_publicIPAddress'))))]"
527+
},
518528
"subnet": {
519529
"id": "[variables('ref_subnet')]"
520530
}
521531
}
522532
}
523-
]
533+
],
534+
"dnsSettings": {
535+
"internalDnsNameLabel": "[if(equals(copyIndex(),0),parameters('adminVMName'),concat(variables('const_managedVMPrefix'), copyIndex()))]"
536+
}
524537
}
525538
},
526539
{
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"location": {
6+
"type": "string",
7+
"metadata": {
8+
"description": "Location for all resources."
9+
}
10+
},
11+
"_globalResourceNameSuffix": {
12+
"type": "string",
13+
"metadata": {
14+
"description": "A unique suffix that was specified during the deployment of the solution template."
15+
}
16+
},
17+
"const_guidTag" :{
18+
"type": "string",
19+
"metadata": {
20+
"description": "A unique tag for resources."
21+
}
22+
},
23+
"_artifactsLocation": {
24+
"type": "string",
25+
"metadata": {
26+
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
27+
}
28+
},
29+
"_artifactsLocationAdminTemplate": {
30+
"defaultValue": "[if(contains(parameters('_artifactsLocation'), 'githubusercontent'), parameters('_artifactsLocation'), deployment().properties.templateLink.uri)]",
31+
"type": "string",
32+
"metadata": {
33+
"description": "If we are deploying from the command line, use the passed in _artifactsLocation, otherwise use the default."
34+
}
35+
},
36+
"_artifactsLocationSasToken": {
37+
"type": "securestring",
38+
"metadata": {
39+
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated. Use the defaultValue if the staging location is not secured."
40+
}
41+
},
42+
"userAssignedIdentityResourceId":{
43+
"type": "string",
44+
"metadata": {
45+
"Description": "UserAssigned Identity"
46+
}
47+
},
48+
"utcValue": {
49+
"type": "string",
50+
"defaultValue": "[utcNow()]"
51+
}
52+
},
53+
"variables": {
54+
"name_postDeploymentscriptFile": "postDeploymentScript.sh"
55+
},
56+
"resources": [
57+
{
58+
"type": "Microsoft.Resources/deploymentScripts",
59+
"apiVersion": "${azure.apiVersionForDeploymentScript}",
60+
"name": "[concat('postdeployscript-', parameters('_globalResourceNameSuffix'))]",
61+
"kind": "AzureCLI",
62+
"location": "[parameters('location')]",
63+
"identity": {
64+
"type": "UserAssigned",
65+
"userAssignedIdentities": {
66+
"[parameters('userAssignedIdentityResourceId')]": {}
67+
}
68+
},
69+
"properties": {
70+
"forceUpdateTag": "[parameters('utcValue')]",
71+
"azCliVersion": "2.9.1",
72+
"timeout": "PT30M",
73+
"cleanupPreference": "OnSuccess",
74+
"retentionInterval": "P1D",
75+
"primaryScriptUri": "[uri(parameters('_artifactsLocationAdminTemplate'), concat('../scripts/', variables('name_postDeploymentscriptFile'), parameters('_artifactsLocationSasToken')))]",
76+
"environmentVariables": [
77+
{
78+
"name": "MANAGED_IDENTITY_ID",
79+
"value": "[parameters('userAssignedIdentityResourceId')]"
80+
},
81+
{
82+
"name": "RESOURCE_GROUP_NAME",
83+
"value": "[resourceGroup().name]"
84+
},
85+
{
86+
"name": "GUID_TAG",
87+
"value": "[parameters('const_guidTag')]"
88+
}
89+
]
90+
}
91+
}
92+
],
93+
"outputs": {
94+
"userAssignedIdentityResource": {
95+
"type": "string",
96+
"value": "[parameters('userAssignedIdentityResourceId')]"
97+
}
98+
}
99+
}

0 commit comments

Comments
 (0)