Associating Hybrid Connections to Azure App Services cannot be automated
There is no way to associate a Hybrid Connection to an Azure App Service via ARM Template or PowerShell.
This is a significant gap since we cannot automate this at all when that is the driving factor for DevOps and PaaS services.
We are looking at options here.
This can now be done in an Azure Resource Manager (ARM) template by using the Microsoft.Web sites/hybridConnectionNamespaces/relays template reference. The schema for that is at https://docs.microsoft.com/en-us/azure/templates/microsoft.web/2019-08-01/sites/hybridconnectionnamespaces/relays
Here is an abbreviated example of what this could look like. (If you want to see a formatted version, then reference https://stackoverflow.com/a/60084323/243992)
"condition": "[equals(parameters('ASPNETCORE_ENVIRONMENT'), 'development')]",
"name": "[concat(variables('relayName'), '/', parameters('hybridConnectionNameAdfsBlueAuth'))]",
"hostname": "[split(json(reference(variables('adfsBlueAuthHybridConnectionResourceId'), '2017-04-01').userMetadata).value, ':')]",
"port": "[split(json(reference(variables('adfsBlueAuthHybridConnectionResourceId'), '2017-04-01').userMetadata).value, ':')]",
"sendKeyValue": "[listkeys(concat(variables('adfsBlueAuthHybridConnectionResourceId'), '/authorizationRules/defaultSender'), '2017-04-01').primaryKey]",
Emil Westholm commented
How is it going with this one? We really need this to be supported to automate our flows end to end for our end customer. At the moment wee need to have a SLA to our customers for days to have this setup manually...
Can anyone help me how to create relay and hybrid connection with hostname and port details using arm templates. I am able to create relay and hybrid connection but not able to create endpoint in it ( key and value with host name and port number)
Stefan Lundmark commented
According to https://feedback.azure.com/forums/169385-web-apps/suggestions/33850393-programmatically-associating-a-hybrid-connection-t this feature is planned for support. But that was posted April 9th 2018.
I really hope it _will_ be implemented very soon.
I did this template to perform it, maybe it could be useful for you.
Devin Lusby commented
After a little creative investigation and guesswork, I successfully deployed a Hybrid Connection to an App Service using the following ARM Snippet. It's a little counter-intuitive matching up the name field to the multi-part resource type, but this does the trick.
Give it a try on your app services!
"location": "Central US",
Tom Puleo commented
*Bump: I can create the Hybrid Connection using New-AzureRmRelayHybridConnection in Powershell, but like the others have stated, I'd like the ability to wire it up to an existing App Service without having to do it manually in the portal.
Very interested to know if this is possible/is going to be implemented.
It's been a year and I don't think this feature is added yet.
Any update on this?
Jivago Pecharki commented
Did we have some progress on this thread? It is really importante to us. Thank you!
What is the timeline on this? This is a huge thorn in our side.
Hello Azure App Service Team, can you please confirm if this is still simply under review. It would be really useful to know if this issue has been addressed yet. As far as I can tell there has been no update from yourselves regarding this issue since it was placed 'Under Review' over 10 months ago.
Brandon Wittwer commented
Pretty important to get this done for some of us. Any headway?
Bablu Lawrence commented
We have end to end automation of environments through releases using PS scripts and ARM deployment templates. The one thing we have to manually add is hybrid connections. Please consider adding this for both deployment templates and REST API.
+1 REST API
Jivago Moreira Pecharki commented
I need the samething, but i need to do it using REST API.