Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

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://) :

 

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:

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

Share the post

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

×

Subscribe to Msdn Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The Msdn Blogs.

Get updates delivered right to your inbox!

Thank you for your subscription

×