couchbase-partners / azure-resource-manager-couchbase

Azure Resource Manager (ARM) Templates for Couchbase Enterprise
Apache License 2.0
7 stars 16 forks source link

Get Public DNS Programmatically #56

Closed benofben closed 7 years ago

benofben commented 7 years ago

Right now we have a hard dependency on the public DNS URL cloudapp.azure.com stuff. This won't work in sovereign clouds. To work there we'd need to do something like this (per Brian):

{ "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": {}, "variables": { "vmssName": "syncgateway", "vmssPipId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Compute/virtualMachineScaleSets/', variables('vmssName'), '/virtualMachines/0/networkInterfaces/nic/ipConfigurations/ipconfig/publicIPAddresses/public')]" }, "resources": [], "outputs": { "vmssPipFqdn": { "type": "string", "value": "[reference(variables('vmssPiPId'), '2017-03-30').dnsSettings.fqdn]" }, "vmssPipIp": { "type": "string", "value": "[reference(variables('vmssPiPId'), '2017-03-30').ipAddress]" } } }

benofben commented 7 years ago

reference(concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Compute/virtualMachineScaleSets/server'), '/virtualMachines/0/networkInterfaces/nic/ipConfigurations/ipconfig/publicIPAddresses/public'), '2017-03-30').dnsSettings.fqdn)

benofben commented 7 years ago

concat(reference(concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Compute/virtualMachineScaleSets/server/virtualMachines/0/networkInterfaces/nic/ipConfigurations/ipconfig/publicIPAddresses/public'), '2017-03-30').dnsSettings.fqdn, ':8091')

benofben commented 7 years ago

Yikes. That works. Amazing.