繁体   English   中英

具有自定义vnet手臂模板的Azure Databricks将无法连接到自定义vnet

[英]Azure Databricks with custom vnet arm template won't connect to the custom vnet

使用以下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')]"
            }
        }
    ]
}

您需要将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": {}
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM