我试图在新的订阅中创建辐条vnet,并尝试通过ARM模板与另一个订阅中的现有集线器vnet进行对等。做这个的最好方式是什么?您如何引用集线器vnet?
这是我引用集线器vnet的方式,没有运气:
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2017-05-10",
"name": "nestedTemplate",
"resourceGroup": "[parameters('secondResourceGroup')]",
"subscriptionId": "[parameters('secondSubscriptionID')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
"type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings",
"apiVersion": "2019-11-01",
"properties": {
"allowVirtualNetworkAccess": true,
"allowForwardedTraffic": true,
"allowGatewayTransit": true,
"useRemoteGateways": false,
"remoteVirtualNetwork": "r_name",
"remoteAddressSpace": {
"addressPrefixes": "CIDR_spcae"
}
]
},
答案 0 :(得分:0)
您可以在remoteVirtualNetwork
参数中以其ID引用其他订阅中的集线器VNet。
Here是一个示例,将<subscription ID>
替换为另一个订阅ID。
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
},
"variables": {
},
"resources": [
{
"apiVersion": "2016-06-01",
"type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings",
"name": "myVnetA/myVnetAToMyVnetB",
"location": "[resourceGroup().location]",
"properties": {
"allowVirtualNetworkAccess": true,
"allowForwardedTraffic": false,
"allowGatewayTransit": false,
"useRemoteGateways": false,
"remoteVirtualNetwork": {
"id": "/subscriptions/<subscription ID>/resourceGroups/PeeringTest/providers/Microsoft.Network/virtualNetworks/myVnetB"
}
}
}
]
}
您还可以从以下博客中获得更多详细信息:Using ARM templates to create Azure Vnets, part 2: peering
答案 1 :(得分:0)
我认为这个。问题是参数引用错误。