CRM 2016 online and Azure Service Bus relay - 50200: Bad Gateway
<p>I'm using Microsoft Dynamics CRM 2016 online and trying to use <a href="https://azure.microsoft.com/en-us/documentation/articles/service-bus-relay-overview/" rel="nofollow">Azure Service Bus relay</a> from custom workflow activity.</p>

<p>I created a custom activity (based on <a href="https://msdn.microsoft.com/en-us/library/gg327854.aspx" rel="nofollow">AzureAwareWorkflowActivity</a> from CRM SDK) and registered an endpoint (details below). Workflow execution ends with the following error:</p>

<p>System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: 50200: Bad Gateway, Resource:sb://****.servicebus.windows.net/update*****. TrackingId:b7681665-****
SystemTracker:NoSystemTracker, Timestamp:10/10/2016 2:15:45 PM (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).</p>

<p>Do you know how to fix this problem?</p>

<p><strong>Workflow activity</strong></p>

<pre><code>namespace Microsoft.Crm.Sdk.Samples
{
    /// &lt;summary&gt;
    /// This class is able to post the execution context to the Windows Azure 
    /// Service Bus.
    /// &lt;/summary&gt;
    public class AzureAwareWorkflowActivity : CodeActivity
    {
        /// &lt;summary&gt;
        /// This method is called when the workflow executes.
        /// &lt;/summary&gt;
        /// &lt;param name="executionContext"&gt;The data for the event triggering
        /// the workflow.&lt;/param&gt;
        protected override void Execute(CodeActivityContext executionContext)
        {
            IWorkflowContext context = executionContext.GetExtension&lt;IWorkflowContext&gt;();

            IServiceEndpointNotificationService endpointService =
                     executionContext.GetExtension&lt;IServiceEndpointNotificationService&gt;();
            endpointService.Execute(ServiceEndpoint.Get(executionContext), context);
        }

        /// &lt;summary&gt;
        /// Enables the service endpoint to be provided when this activity is added as a 
        /// step in a workflow.
        /// &lt;/summary&gt;
        [RequiredArgument]
        [ReferenceTarget("serviceendpoint")]
        [Input("Input id")]
        public InArgument&lt;EntityReference&gt; ServiceEndpoint { get; set; }
    }
}
</code></pre>

<p><strong>Endpoint</strong></p>

<p><a href="http://i.stack.imgur.com/Riw1G.png" rel="nofollow">Endpoint configuration</a></p>