Skip to content

Commit 769883c

Browse files
committed
private network
Signed-off-by: Piotr Karpala <[email protected]>
1 parent 895a123 commit 769883c

File tree

3 files changed

+89
-5
lines changed

3 files changed

+89
-5
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ pnpm-debug.log*
2323
*.sw?
2424
.azure
2525

26-
api/public
26+
api/public
27+
test.http

azure-deploy/with-app-registration/azuredeploy.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@
4545
"metadata": {
4646
"description": "Docker image for metrics viewer - use default or replace with your own"
4747
}
48+
},
49+
"subnetId": {
50+
"type": "string",
51+
"defaultValue": "",
52+
"metadata": {
53+
"description": "Subnet ID (at least /23) for the managed environment when deploying app without public access"
54+
}
4855
}
4956
},
5057
"variables": {
@@ -140,6 +147,10 @@
140147
"customerId": "[reference(concat('Microsoft.OperationalInsights/workspaces/', variables('workspaceName')), '2020-08-01').customerId]",
141148
"sharedKey": "[listKeys(concat('Microsoft.OperationalInsights/workspaces/', variables('workspaceName')), '2020-08-01').primarySharedKey]"
142149
}
150+
},
151+
"vnetConfiguration": {
152+
"infrastructureSubnetId" : "[parameters('subnetId')]",
153+
"internal": "[if(equals(parameters('subnetId'), ''), json('false'), json('true'))]"
143154
}
144155
}
145156
},

azure-deploy/with-token/azuredeploy.json

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
},
2222
"github-organization": {
2323
"type": "string",
24-
"defaultValue":"",
24+
"defaultValue": "",
2525
"metadata": {
2626
"description": "GitHub Organization - provide only if application-scope is organization"
2727
}
2828
},
2929
"github-enterprise": {
3030
"type": "string",
31-
"defaultValue":"",
31+
"defaultValue": "",
3232
"metadata": {
3333
"description": "GitHub Enterprise - provide only if application-scope is enterprise"
3434
}
@@ -39,12 +39,21 @@
3939
"metadata": {
4040
"description": "Docker image for metrics viewer - use default or replace with your own"
4141
}
42+
},
43+
"subnetId": {
44+
"type": "string",
45+
"defaultValue": "",
46+
"metadata": {
47+
"description": "Subnet ID (at least /23) for the managed environment when deploying app without public access"
48+
}
4249
}
4350
},
4451
"variables": {
4552
"environmentName": "[concat(parameters('name'),'-env')]",
4653
"workspaceName": "[concat(parameters('name'),'-ai')]",
47-
"app-scope": "[if(not(empty(parameters('github-organization'))), 'organization', if(not(empty(parameters('github-enterprise'))), 'enterprise', ''))]"
54+
"app-scope": "[if(not(empty(parameters('github-organization'))), 'organization', if(not(empty(parameters('github-enterprise'))), 'enterprise', ''))]",
55+
"vnetId": "[concat(split(parameters('subnetId'), '/subnets/')[0])]",
56+
"dnsZoneName": "azurecontainerapps.io"
4857
},
4958
"resources": [
5059
{
@@ -130,9 +139,58 @@
130139
"customerId": "[reference(concat('Microsoft.OperationalInsights/workspaces/', variables('workspaceName')), '2020-08-01').customerId]",
131140
"sharedKey": "[listKeys(concat('Microsoft.OperationalInsights/workspaces/', variables('workspaceName')), '2020-08-01').primarySharedKey]"
132141
}
142+
},
143+
"vnetConfiguration": {
144+
"infrastructureSubnetId": "[parameters('subnetId')]",
145+
"internal": "[if(equals(parameters('subnetId'), ''), json('false'), json('true'))]"
133146
}
134147
}
135148
},
149+
{
150+
"type": "Microsoft.Network/privateDnsZones",
151+
"apiVersion": "2020-06-01",
152+
"name": "[variables('dnsZoneName')]",
153+
"location": "global",
154+
"condition": "[not(equals(parameters('subnetId'), ''))]",
155+
"properties": {},
156+
"dependsOn": [
157+
"[concat('Microsoft.App/managedEnvironments/', variables('environmentName'))]"
158+
]
159+
},
160+
{
161+
"type": "Microsoft.Network/privateDnsZones/A",
162+
"apiVersion": "2020-06-01",
163+
"name": "[concat(variables('dnsZoneName'), '/*')]",
164+
"properties": {
165+
"TTL": 3600,
166+
"ARecords": [
167+
{
168+
"ipv4Address": "[reference(concat('Microsoft.App/managedEnvironments/', variables('environmentName')), '2024-02-02-preview').staticIp]"
169+
170+
}
171+
]
172+
},
173+
"dependsOn": [
174+
"[resourceId('Microsoft.Network/privateDnsZones', variables('dnsZoneName'))]",
175+
"[concat('Microsoft.App/managedEnvironments/', variables('environmentName'))]"
176+
]
177+
},
178+
{
179+
"type": "Microsoft.Network/privateDnsZones/virtualNetworkLinks",
180+
"apiVersion": "2020-06-01",
181+
"name": "[concat(variables('dnsZoneName'), '/', variables('environmentName'), '-vnet-link')]",
182+
"location": "global",
183+
"dependsOn": [
184+
"[resourceId('Microsoft.Network/privateDnsZones', variables('dnsZoneName'))]"
185+
],
186+
"condition": "[not(equals(parameters('subnetId'), ''))]",
187+
"properties": {
188+
"virtualNetwork": {
189+
"id": "[variables('vnetId')]"
190+
},
191+
"registrationEnabled": false
192+
}
193+
},
136194
{
137195
"apiVersion": "2020-08-01",
138196
"name": "[variables('workspaceName')]",
@@ -147,5 +205,19 @@
147205
"workspaceCapping": {}
148206
}
149207
}
150-
]
208+
],
209+
"outputs": {
210+
"metrics-viewer-url": {
211+
"type": "string",
212+
"value": "[reference(concat('Microsoft.App/containerapps/', parameters('name')), '2024-02-02-preview').latestRevisionFqdn]"
213+
},
214+
"managed-environment-ip": {
215+
"type": "string",
216+
"value": "[reference(concat('Microsoft.App/managedEnvironments/', variables('environmentName')), '2024-02-02-preview').staticIp]"
217+
},
218+
"managed-environment-domain": {
219+
"type": "string",
220+
"value": "[reference(concat('Microsoft.App/managedEnvironments/', variables('environmentName')), '2024-02-02-preview').defaultDomain]"
221+
}
222+
}
151223
}

0 commit comments

Comments
 (0)