【问题标题】:Azure Databricks with custom vnet arm template won't connect to the custom vnet具有自定义 vnet 臂模板的 Azure Databricks 不会连接到自定义 vnet
【发布时间】:2019-10-19 01:05:01
【问题描述】:

使用以下 ARM 模板,我部署了具有自定义托管资源组名称的 Azure Databricks,并将工作人员添加到自定义 VNET。在门户中,这工作正常。但是当我尝试在 ARM 模板中执行此操作时,托管资源组会继续为工作人员部署工作人员 vnet。我认为我在正确的轨道上,但缺少一个设置。但是想不通。有没有人可以看到我错过了什么?

来源 ARM:https://github.com/Azure/azure-quickstart-templates/tree/master/101-databricks-workspace-with-vnet-injection

{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "databricksName": {
            "type": "string",
            "metadata": {
                "description": "The name of the databricks workspace"
            }
        },
        "pricingTier": {
            "type": "string",
            "allowedValues": [
                "trial",
                "standard",
                "premium"
            ],
            "metadata": {
                "description": "The pricing tier of workspace."
            }
        },
        "managedResourceGroupName": {
            "type": "string",
            "metadata": {
                "description": "The name of the managed resource group that databricks will create"
            }
        },
        "Location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "The Location of the deployment"
            }
        },
        "vnetName": {
            "type": "string",
            "metadata": {
                "description": "The Name of the virtual network where the Workers would be connected to"
            }
        },
        "privateSubnetName": {
            "defaultValue": "public-subnet",
            "type": "string",
            "metadata": {
                "description": "The name of the private subnet to create."
            }
        },
        "publicSubnetName": {
            "defaultValue": "private-subnet",
            "type": "string",
            "metadata": {
                "description": "The name of the public subnet to create."
            }
        }
    },
    "variables": {
        "ManagedResourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('managedResourceGroupName'))]",
        "vnetId": "[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]"
    },
    "resources": [
        {
            "name": "[parameters('databricksName')]",
            "type": "Microsoft.Databricks/workspaces",
            "apiVersion": "2018-04-01",
            "tags": {
                "description": "MIG6 databricks workspace",
                "costCenter": "WPIPM12SG552"
            },
            "location": "[parameters('Location')]",
            "properties": {
                "managedResourceGroupId": "[variables('managedResourceGroupId')]",
                "parameters": {
                    "customVirtualNetworkId": {
                        "value": "[variables('vnetId')]"
                    },
                    "customPublicSubnetName": {
                        "value": "[parameters('publicSubnetName')]"
                    },
                    "customPrivateSubnetName": {
                        "value": "[parameters('privateSubnetName')]"
                    }
                }
            },
            "sku": {
                "name": "[parameters('pricingTier')]"
            }
        }
    ]
}

【问题讨论】:

    标签: azure powershell databricks arm-template azure-databricks


    【解决方案1】:

    您需要将 vnet 嵌套在模板中,这对我有用:

    {
        "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {
            "vnetName": {
                "type": "string"
            },
            "vnetRG": {
                "type": "string"
            },
            "publicSubnetName": {
                "type": "string"
            },
            "publicSubnetCIDR": {
                "type": "string"
            },
            "privateSubnetName": {
                "type": "string"
            },
            "privateSubnetCIDR": {
                "type": "string"
            },
            "workspaceName": {
                "type": "string"
            },
            "tier": {
                "type": "string"
            },
            "location": {
                "type": "string"
            },
            "nsgName": {
                "defaultValue": "databricks-nsg",
                "type": "string"
            },
            "environment": {
                "type": "string"
            }
        },
        "resources": [
            {
                "apiVersion": "2017-05-10",
                "name": "nestedTemplate",
                "type": "Microsoft.Resources/deployments",
                "resourceGroup": "[parameters('vnetRG')]",
                "properties": {
                    "mode": "Incremental",
                    "template": {
                        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                        "contentVersion": "1.0.0.0",
                        "parameters": {},
                        "variables": {},
                        "resources": [
                            {
                                "apiVersion": "2018-04-01",
                                "type": "Microsoft.Network/virtualNetworks/subnets",
                                "name": "[concat(parameters('vnetName'), '/', parameters('publicSubnetName'))]",
                                "location": "[parameters('location')]",
                                "properties": {
                                    "addressPrefix": "[parameters('publicSubnetCIDR')]",
                                    "networkSecurityGroup": {
                                        "id": "[variables('nsgId')]"
                                    }
                                }
                            },
                            {
                                "apiVersion": "2018-04-01",
                                "type": "Microsoft.Network/virtualNetworks/subnets",
                                "name": "[concat(parameters('vnetName'), '/', parameters('privateSubnetName'))]",
                                "location": "[parameters('location')]",
                                "dependsOn": [
                                    "[concat('Microsoft.Network/virtualNetworks/', parameters('vnetName'), '/subnets/', parameters('publicSubnetName'))]"
                                ],
                                "properties": {
                                    "addressPrefix": "[parameters('privateSubnetCIDR')]",
                                    "networkSecurityGroup": {
                                        "id": "[variables('nsgId')]"
                                    }
                                }
                            }
                        ]
                    },
                    "parameters": {}
                }
            },
            {
                "apiVersion": "2018-04-01",
                "type": "Microsoft.Databricks/workspaces",
                "location": "[parameters('location')]",
                "name": "[parameters('workspaceName')]",
                "dependsOn": [
                    "['Microsoft.Resources/deployments/nestedTemplate']"
                ],
                "sku": {
                    "name": "[parameters('tier')]"
                },
                "comments": "Please do not use an existing resource group for ManagedResourceGroupId.",
                "properties": {
                    "ManagedResourceGroupId": "[variables('managedResourceGroupId')]",
                    "parameters": {
                        "customVirtualNetworkId": {
                            "value": "[variables('vnetId')]"
                        },
                        "customPublicSubnetName": {
                            "value": "[parameters('publicSubnetName')]"
                        },
                        "customPrivateSubnetName": {
                            "value": "[parameters('privateSubnetName')]"
                        }
                    }
                }
            }
        ],
        "variables": {
            "managedResourceGroupId": "[concat(subscription().id, '/resourceGroups/', variables('managedResourceGroupName'))]",
            "managedResourceGroupName": "[concat(resourceGroup().name,'-DATABRICKS-MANAGED')]",
            "vnetId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('vnetRG'), '/providers/Microsoft.Network/virtualNetworks/', parameters('vnetName'))]",
            "nsgId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('vnetRG'), '/providers/Microsoft.Network/networkSecurityGroups/', parameters('nsgName'))]"
        },
        "outputs": {}
    }
    

    【讨论】:

    • 您将什么用于您的 NSG 和子网的地址前缀参数。因为我不明白为什么将 Vnet 创建放在 ARM 中会有所不同,因为它部署在数据块之前。 PS:这不是为了打扰您可以正常工作的答案,只是我的客户已经创建了一个 vnet,并且它必须在该 vnet 内。
    • 可以指向现有的 vnet - 确保设置相同 - 或替换为原始 vnet 部署中的链接模板。因此,您可以只导出 vnet 模板并将其放在这里 - 如果它有其他子网,您可以安全地删除它们。很容易使用虚拟 vnet 进行测试。
    • 我正在使用虚拟 vnet atm 进行测试 :) 但无论如何,databricks 正在为托管资源组中的工作人员创建一个 vnet,而不是使用现有的 vnet。
    • 它仍然在托管资源组内创建一个 vnet(不知道为什么)。但是您也应该连接到您分配的 vnet。如果您查看您的 vnet(非托管),您应该会看到 vm 已连接?
    • 它不会让你 - 上面有一个你无法移除的锁。
    猜你喜欢
    • 2022-12-14
    • 1970-01-01
    • 2018-08-15
    • 2021-09-28
    • 1970-01-01
    • 2017-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多