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