Search code examples
azureazure-web-app-serviceazure-cliazure-hybrid-connections

Connect webapp to hybrid connection


I have a webapp in one resource group, and a hybrid connection in another resource group. How can I connect this webapp that is in one RG to the Hybrid connection that is in another?

The command to connect to HC looks like this:

az webapp hybrid-connection add -g MyResourceGroup -n MyWebapp --namespace [HybridConnectionNamespace] --hybrid-connection [HybridConnectionName] -s [slot]

How can I solve this?


Solution

  • There is no resource group related limit in this case, just use the command as the sample you mentioned.

    My web app and hybrid connection locate in different resource group with different region, it work fine.

    az webapp hybrid-connection add -g '<webapp-group>' -n '<webapp-name>' --namespace '<relay-name>' --hybrid-connection '<connection-name>'
    

    enter image description here


    Tip:

    If you got the error like below, please make sure you have set the User Metadata for the hybrid connection.

    enter image description here

    In my sample, testhost is the Endpoint Host, 123 is the Endpoint Port.

    [{"key":"endpoint","value":"testhost:123"}]
    

    enter image description here