In arm template, how can I fetch privatelink's privateIPAddress ?

stefan.olivebring 96 Reputation points
2021-03-13T14:25:09.893+00:00

Hi

Is it possible to within ARM template fetch the privateIPaddress of a privatelink created in the same template ?

Regards
Stefan

Azure Private Link
Azure Private Link
An Azure service that provides private connectivity from a virtual network to Azure platform as a service, customer-owned, or Microsoft partner services.
470 questions
0 comments No comments
{count} votes

Accepted answer
  1. stefan.olivebring 96 Reputation points
    2021-03-13T15:36:03.507+00:00

    solved it, I added

    ...
    {
    "type": "Microsoft.Resources/deployments",
    "apiVersion": "2015-01-01",
    "name": "privateEndpointDeployment",
    "properties": {
    "mode": "Incremental",
    "parameters": {
    "stgNicId": { "value": "[reference(resourceId('Microsoft.Network/privateEndpoints', variables('privateEndpoint').stgPrivateEndpointName), '2019-11-01').networkInterfaces[0].id]" }
    },
    "template": {
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
    "stgNicId": {
    "type": "string"
    }
    },
    "variables": {},
    "resources": [],
    "outputs": {
    "stgNicIP": {
    "type": "string",
    "value": "[[reference(parameters('stgNicId'), '2019-07-01').ipConfigurations[0].properties.privateIPAddress]"
    }
    }
    }
    }
    },
    ...

    then i can reference the privateIP using

    reference('privateEndpointDeployment', '2015-01-01').outputs.stgNicIP.value

    0 comments No comments

0 additional answers

Sort by: Most helpful