Azure / Azure/azure-quickstart-templates
Impossible to retreive dynamic IP address after deployment
- Dominant language
- Bicep
- Stars
- 14.9k
- Forks
- 16.2k
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 6
Description
### 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:
``` json
{
"$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**:
``` json
{
"$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:
``` json
{
"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
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue provides two Azure Resource Manager JSON templates rather than naming repository files. Start by deploying both examples and inspecting the output evaluation and deployment-operation errors, then compare how reference(...).ipAddress behaves for static and dynamic allocation. Done means a confirmed explanation and a clearly scoped repository change, if one is possible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100