[英]Azure Bastion into Existing Vnet
Hi I'm trying to deploy an AzureBastion into a seperate vnet which is in a separate resourcegroup from the bastion.您好,我正在尝试将 AzureBastion 部署到独立的 vnet 中,该 vnet 位于与堡垒不同的资源组中。 I keep getting the error below,
我不断收到以下错误,
New-AzSubscriptionDeployment : 10:49:03 - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The resource
'Microsoft.Network/virtualNetworks/vnet1/subnets/AzureBastionSubnet' is not defined in the template. Please see https://aka.ms/arm-template for usage details.'.
At C:\Temp\New-Deployment\deploy-core.ps1:53 char:1
The template is at模板在
"https://pastebin.com/embed_js/ET9HwFJ9" “https://pastebin.com/embed_js/ET9HwFJ9”
Can anyone see where I'm going wrong, driving me insane谁能看到我哪里出错了,让我发疯
I should add this is a nested template, called by a master template.我应该添加这是一个嵌套模板,由主模板调用。 which is below:
如下:
"https://pastebin.com/embed_js/Uf3asC9c" “https://pastebin.com/embed_js/Uf3asC9c”
Thanks in advance :)提前致谢 :)
Please follow the following ARM template, it allows you to:请遵循以下 ARM 模板,它允许您:
**- Add the subnet “AzureBastionSubnet” which is required to create a Bastion. **- 添加创建堡垒所需的子网“AzureBastionSubnet”。
Deploy template.json:部署 template.json:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string"
},
"resourceGroup": {
"type": "string"
},
"bastionHostName": {
"type": "string"
},
"subnetName": {
"type": "string"
},
"publicIpAddressName": {
"type": "string"
},
"existingVNETName": {
"type": "string"
},
"subnetAddressPrefix": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "2019-02-01",
"type": "Microsoft.Network/publicIpAddresses",
"name": "[parameters('publicIpAddressName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"properties": {
"publicIPAllocationMethod": "Static"
},
"tags": {}
},
{
"apiVersion": "2018-04-01",
"type": "Microsoft.Network/virtualNetworks/subnets",
"name": "[concat(parameters('existingVNETName'), '/', parameters('subnetName'))]",
"location": "[parameters('location')]",
"properties": {
"addressPrefix": "[parameters('subnetAddressPrefix')]"
}
},
{
"apiVersion": "2018-10-01",
"type": "Microsoft.Network/bastionHosts",
"name": "[parameters('bastionHostName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId(parameters('resourceGroup'), 'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "IpConf",
"properties": {
"subnet": {
"id": "[resourceId(parameters('resourceGroup'), 'Microsoft.Network/virtualNetworks/subnets', parameters('existingVNETName'),parameters('subnetName'))]"
},
"publicIPAddress": {
"id": "[resourceId(parameters('resourceGroup'), 'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]"
}
}
}
]
},
"tags": {}
}
]
} }
Paramtere template:参数模板:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceGroup": {
"value": "testAmine"
},
"bastionHostName": {
"value": "TestBast"
},
"publicIpAddressName": {
"value": "testamine-vnet-ip"
},
"subnetName": {
"value": "AzureBastionSubnet"
},
"existingVNETName":
{
"value": "testamine-vnet"
},
"subnetAddressPrefix":
{
"value": "10.0.1.0/27"
},
"location": {
"value": "westeurope"
}
}
} }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.