Azure API Apps–Troubleshooting PowerApps Export error: Unable to download Swagger 2.0 metadata. Please verify that the URL is publicly accessible. You may need to enable CORS for the App Service portal extension located at


Overview

There is functionality in the Azure Portal that allows you to use the API definition of your Azure App Service and Export this through the “Export to PowerApps + Microsoft Flow” button in the API definition blade of your app ref: https://docs.microsoft.com/azure/app-service/app-service-export-api-to-powerapps-and-flow .  If you get the error: “Unable to download Swagger 2.0 metadata. Please verify that the URL is publicly accessible. You may need to enable CORS for the App Service portal extension located at”  It can be sometimes difficult to resolve this error.  This should help you however!

Solution

As the error suggests there are a couple of potential problems.  You need to understand how to verify the Swagger 2.0 Metadata is formatted correctly, that it is publicly available, and is not restricted for access by your CORS settings.  There is also a bug in certain browsers (that is being addressed currently) that requires you to use Edge or Chrome to use this feature.

Are you using a supported Browser?

Currently only Edge and Chrome work.  This is being fixed very soon.

Is the Swagger endpoint HTTPS?

The API definition location has to be https (see below).  If you try http in this setting it will fail with the error I mentioned above

Is the Swagger publicly available?

Ensure that you can hit the API definition location in an In-Private or Incognito browser with no problem.  You should not be prompted for any authentication and you should be able to download the JSON that defines your API in Swagger 2.0.  If you cannot, you need to fix that first!  You can see the API definition location in your portal (again, note it must be https://) :

capture20170406104837219

 

Is the Swagger properly configured?

Look at the download you got from your In-Private or Incognito test above.  Does it look correct?

{
  "swagger": "2.0",
  "info": {
    "version": "v1",
    "title": "WebApplication6"
  },
  "host": "webapplication620170406101400.azurewebsites.net",
  "schemes": [ "https" ],
  "paths": {
    "/api/Values": {
      "get": {
        "tags": [ "Values" ],
        "operationId": "GetAll",
        "consumes": [],
        "produces": [ "application/json", "text/json", "application/xml", "text/xml" ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "array",
              "items": { "type": "string" }
            }

ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md

 

Is CORS configured correctly?

The error message should tell you what CORS entry you need.  For example, I need to add https://web1.appsvcux.ext.azure.com to CORS and save it:

capture20170406105659264

capture20170406105822524

 

Conclusion

These are the basics to troubleshooting that error message.  Please drop me a note if you found this useful!

Link to this functionality: https://docs.microsoft.com/azure/app-service/app-service-export-api-to-powerapps-and-flow


Comments (0)

Skip to main content