1

我可以通过门户为存储队列创建一个专用端点,并且在使用 KUDU 的 nameresolver.exe 进行检查时,它可以按预期工作。但是,我正在努力寻找一个可以一次性完成此操作的 ARM 模板。

我已使此模板工作,但我可以看到在生成的私有 DNS 区域中没有生成A 记录条目。我不知道如何创建该 A 记录条目,并且似乎无法在线找到描述此内容的 ARM 模板:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "privateEndpointName": {
            "type": "string",
            "defaultValue": "privendpoint-sapriv01-queue"
        },
        "vnetName": {
            "type": "string",
            "defaultValue": "vn-myvnet01"
        },
        "subnetName": {
            "type": "string",
            "defaultValue": "sn-private-endpoints"
        },
        "groupId": {
            "type": "string",
            "defaultValue": "queue"
        }
    },
    "variables": {
        "privateDNSZone_name": "[concat('privatelink', '.queue.', environment().suffixes.storage)]"
    },
    "resources": [
        {
            "apiVersion": "2019-04-01",
            "name": "[parameters('privateEndpointName')]",
            "type": "Microsoft.Network/privateEndpoints",
            "location": "[resourceGroup().Location]",
            "properties": {
                "privateLinkServiceConnections": [
                    {
                        "name": "[parameters('privateEndpointName')]",
                        "properties": {
                            "privateLinkServiceId": "[resourceId('Microsoft.Storage/storageAccounts', 'saprivendpointdemo')]",
                            "groupIds": [
                                "[parameters('groupId')]"
                            ]
                        }
                    }
                ],
                "manualPrivateLinkServiceConnections": [],
                "subnet": {
                    "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName') )]"
                }
            }
        },
        {
            "type": "Microsoft.Network/privateDnsZones",
            "apiVersion": "2018-09-01",
            "name": "[variables('privateDNSZone_name')]",
            "location": "global",
            "tags": {},
            "properties": {}
        },
        {
            "type": "Microsoft.Network/privateDnsZones/virtualNetworkLinks",
            "apiVersion": "2018-09-01",
            "name": "[concat(variables('privateDNSZone_name'), '/', parameters('vnetName'), 'link' )]",
            "location": "global",
            "dependsOn": [
                "[resourceId('Microsoft.Network/privateDnsZones', variables('privateDNSZone_name'))]"
            ],
            "properties": {
                "virtualNetwork": {
                    "id": "[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]"
                },
                "registrationEnabled": false
            }
        }
    ],
    "outputs": {
    }
}

我认为微软过于复杂了。私有 IP 是自动生成的,我不知道如何在 ARM 模板中引用此 IP。

4

1 回答 1

2

如果要在 Azure 私有 DNS 区域中添加A 记录,可以Microsoft.Network/privateEndpoints/privateDnsZoneGroups在模板中定义。

例如

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "privateEndpointName": {
            "type": "string",
            "defaultValue": "testqueue"
        },
        "vnetName": {
            "type": "string",
            "defaultValue": "teststorage"
        },
        "subnetName": {
            "type": "string",
            "defaultValue": "default"
        },
        "groupId": {
            "type": "string",
            "defaultValue": "queue"
        }
    },
    "variables": {
        "privateDNSZone_name": "[concat('privatelink', '.queue.', environment().suffixes.storage)]"
    },
    "resources": [
        {
            "apiVersion": "2019-04-01",
            "name": "[parameters('privateEndpointName')]",
            "type": "Microsoft.Network/privateEndpoints",
            "location": "[resourceGroup().Location]",
            "properties": {
                "privateLinkServiceConnections": [
                    {
                        "name": "[parameters('privateEndpointName')]",
                        "properties": {
                            "privateLinkServiceId": "[resourceId('Microsoft.Storage/storageAccounts', 'teststorage05')]",
                            "groupIds": [
                                "[parameters('groupId')]"
                            ]
                        }
                    }
                ],
                "manualPrivateLinkServiceConnections": [],
                "subnet": {
                    "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName') )]"
                }
            }
        },
        {
            "type": "Microsoft.Network/privateDnsZones",
            "apiVersion": "2018-09-01",
            "name": "[variables('privateDNSZone_name')]",
            "dependsOn": [
                "[parameters('privateEndpointName')]"
            ],
            "location": "global",
            "tags": {},
            "properties": {}
        },
        {
            "type": "Microsoft.Network/privateDnsZones/virtualNetworkLinks",
            "apiVersion": "2018-09-01",
            "name": "[concat(variables('privateDNSZone_name'), '/', parameters('vnetName'), 'link' )]",
            "location": "global",
            "dependsOn": [
                "[resourceId('Microsoft.Network/privateDnsZones', variables('privateDNSZone_name'))]"
            ],
            "properties": {
                "virtualNetwork": {
                    "id": "[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]"
                },
                "registrationEnabled": false
            }
        },
        {
            "type": "Microsoft.Network/privateEndpoints/privateDnsZoneGroups",
            "apiVersion": "2020-03-01",
            "name": "[concat(parameters('privateEndpointName'), '/', 'default')]",
            "dependsOn": [
                "[parameters('privateEndpointName')]",
                "[variables('privateDNSZone_name')]"
            ],
            "location": "[resourceGroup().Location]",
            "properties": {
                "privateDnsZoneConfigs": [
                    {
                        "name": "privatelink-queue-core-windows-net",
                        "properties": {
                            "privateDnsZoneId": "[resourceId('Microsoft.Network/privateDnsZones',variables('privateDNSZone_name'))]"
                        }
                    }
                ]
            }
        }
    ],
    "outputs": {
    }
}

在此处输入图像描述 在此处输入图像描述

有关更多详细信息,请参阅此处此处

于 2020-10-16T02:30:19.190 回答