title: Azure does not display custom error message for hosted .net core API
body: <p>I have the following API endpoint:</p>
  <pre><code>[AllowAnonymous]
      [HttpPost(&quot;login&quot;)]
      public async Task&lt;IActionResult&gt; Authenticate([FromBody] LoginViewModel credentials)
      {
          try
          {
              var result = await _facade.SomeMethodThatFailsAndThrowsCustomCode4001(credentials);
              return Ok(result);
          }
          catch (CustomException cEx)
          {
              return StatusCode(4001, new { Message = cEx.FriendlyMessage ?? &quot;&quot; }); //Message = Our custom user friendly message
          }
      }
  </code></pre>
  <p>When hosted on external server through IIS, these messages were returned perfectly.  When hosted on Azure, the messages are not showing, and this is the response received:</p>
  <pre><code>{
    &quot;Message&quot;: &quot;&quot;
  }
  </code></pre>
  <p>I have read about <a href="https://docs.microsoft.com/en-us/azure/api-management/api-management-error-handling-policies" rel="nofollow noreferrer">Policies allowed in on-error</a>, but this means I will need to register my <code>.Net Core</code> API with the API management in Azure, and not sure if this is necessary.</p>
  <p>What would be required to be configured to allow our custom messages returned through our API hosted in Azure?</p>