tests/functional/Microsoft.Network/privateEndpoints/deploy/deploy.json

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "privateEndpointName": {
            "type": "string",
            "metadata": {
                "description": "Required. Name of the private endpoint resource to create."
            }
        },
        "groupId": {
            "type": "array",
            "metadata": {
                "description": "Required. Subtype(s) of the connection to be created. The allowed values depend on the type serviceResourceId refers to."
            }
        },
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "Optional. Location for all Resources."
            }
        },
        "virtualNetworkName": {
            "type": "string"
        },
        "addressSpaces": {
            "type": "array"
        },
        "subnet0_name": {
            "type": "string"
        },
        "subnet0_addressRange": {
            "type": "string"
        },
        "ddosProtectionPlanEnabled": {
            "type": "bool"
        },
        "keyVaultName": {
            "type": "string",
            "defaultValue": "[uniqueString(resourceGroup().id)]"
        },
        "accessPolicies": {
            "type": "array",
            "defaultValue": [
            ],
            "metadata": {
                "description": "Optional. Array of access policies object"
            }
        }
    },
    "resources": [
        {
            "type": "Microsoft.KeyVault/vaults",
            "apiVersion": "2019-09-01",
            "name": "[parameters('keyVaultName')]",
            "location": "[parameters('location')]",
            "properties": {
            "accessPolicies": "[parameters('accessPolicies')]",
            "tenantId": "[subscription().tenantId]",
                "sku": {
                    "name": "Standard",
                    "family": "A"
                }
            }
        },
        {
            "name": "[parameters('virtualNetworkName')]",
            "type": "Microsoft.Network/VirtualNetworks",
            "apiVersion": "2021-01-01",
            "location": "[parameters('location')]",
            "dependsOn": [],
            "properties": {
                "addressSpace": {
                    "addressPrefixes": "[parameters('addressSpaces')]"
                },
                "subnets": [
                    {
                        "name": "[parameters('subnet0_name')]",
                        "properties": {
                            "addressPrefix": "[parameters('subnet0_addressRange')]"
                        }
                    }
                ],
                "enableDdosProtection": "[parameters('ddosProtectionPlanEnabled')]"
            }
        },
        {
            "type": "Microsoft.Network/privateEndpoints",
            "apiVersion": "2020-07-01",
            "name": "[parameters('privateEndpointName')]",
            "location": "[parameters('location')]",
            "dependsOn":[
                "[resourceId('Microsoft.Network/VirtualNetworks',parameters('virtualNetworkName'))]"
            ],
            "properties": {
                "privateLinkServiceConnections": [
                    {
                        "name": "[parameters('privateEndpointName')]",
                        "properties": {
                            "privateLinkServiceId": "[resourceId('Microsoft.KeyVault/vaults',parameters('keyVaultName'))]",
                            "groupIds": "[parameters('groupId')]"
                        }
                    }
                ],
                "manualPrivateLinkServiceConnections": [],
                "subnet": {
                    "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets',parameters('virtualNetworkName'),parameters('subnet0_name'))]"
                }
            }
        }
    ],
    "outputs": {
        "privateEndpointResourceGroup": {
            "type": "string",
            "value": "[resourceGroup().name]",
            "metadata": {
                "description": "The name of the Resource Group the resources was deployed to."
            }
        },
        "privateEndpointResourceId": {
            "type": "string",
            "value": "[resourceId('Microsoft.Network/privateEndpoints', parameters('privateEndpointName'))]",
            "metadata": {
                "description": "The Resource Id of the private Endpoint."
            }
        },
        "privateEndpointName": {
            "type": "string",
            "value": "[parameters('privateEndpointName')]",
            "metadata": {
                "description": "The Name of the deployed private endpoint."
            }
        }
    }
}