azure-quickstart-templates
azure-quickstart-templates copied to clipboard
Impossible to retreive dynamic IP address after deployment
Issue Details
It's possible to retrieve a static IP address in outputs of a template but not a dynamic IP.
Repro steps
This template works, the IP is in the outputs:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"publicIPAddresses_name": {
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[parameters('publicIPAddresses_name')]",
"apiVersion": "2017-06-01",
"location": "westeurope",
"properties": {
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "Static",
"idleTimeoutInMinutes": 4
}
}
],
"outputs": {
"resourceID": {
"type": "String",
"value": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_name'))]"
},
"ipaddress": {
"type": "String",
"value": "[reference(parameters('publicIPAddresses_name')).ipAddress]"
}
}
}
This template does not work:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"publicIPAddresses_name": {
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[parameters('publicIPAddresses_name')]",
"apiVersion": "2017-06-01",
"location": "westeurope",
"properties": {
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "Dynamic",
"idleTimeoutInMinutes": 4
}
}
],
"outputs": {
"resourceID": {
"type": "String",
"value": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_name'))]"
},
"ipaddress": {
"type": "String",
"value": "[reference(parameters('publicIPAddresses_name')).ipAddress]"
}
}
}
The error message is:
{
"code":"DeploymentOutputEvaluationFailed",
"message":"Unable to evaluate template outputs: 'ipaddress'. Please see error details and deployment operations. Please see https://aka.ms/arm-debug for usage details.",
"details":[
{
"code":"DeploymentOutputEvaluationFailed",
"target":"ipaddress",
"message":"The template output 'ipaddress' is not valid: The language expression property 'ipAddress' doesn't exist, available properties are 'provisioningState, resourceGuid, publicIPAddressVersion, publicIPAllocationMethod, idleTimeoutInMinutes'.."
}
]
}
Why is it working for static IP but not dynamic?
Thanks
Hi team, Any update on this issue?
CC @zjpjack
Hi, I solved my issue with the help of a PM whom shared with me a trick. This template can help you to understand how: https://github.com/Azure/azure-quickstart-templates/tree/master/201-application-gateway-webapp-iprestriction
The link from @MCKLMT has changed to: https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/application-gateway-webapp-iprestriction