Swagger not working from azure API management service - azure

Steps to enable swagger. From code it is enabled. From API App it is working. But not when I place my API app behind API management

Related

How to wrap an asp.net WebApi project with azure API management?

I am having a Web API project in asp.net and this project is hosted on Azure web app services .Azure endpoint of the api works . How can i wrap this api under azure api management ?
Current setup
Asp.net web Api project > Hosted in azure web app services
I tried to add the api in API management via blank and open api specification.
I would expect the Azure API Management could connect to my web app service where my asp.net web api project is hosted.
Deploy your Web API to Azure App Service API App instead of App Service Web App. You will be able to import the API's directly from the UI. Here is the doc.
Alternative to Ketan's approach is to configure API manually using "Blank API" option. where you'll need to specify your App's base URL. You will be required later on to create all operations manually.

Securing API App Service sitting behind Azure API Management

I have a design issue that I've been struggling with in Azure. I have created a .NET Core API and deployed it as an App Service in Azure. On top of that, I have an instance of Azure API Management with oAuth 2 securing it. I was able to achieve this by following this tutorial:
https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-protect-backend-with-aad
So, the API Management instance is secured with policies and rate limiting, but the back-end URL is wide open and requires no authentication. What is the best process to secure the back-end URL?
you can set APIM public IP in accessing whitelist of your App service to make sure only APIM requests will be able to access your App Service. For how to set IP restriction , you may refer to this doc : https://learn.microsoft.com/en-us/azure/app-service/app-service-ip-restrictions#adding-and-editing-ip-restriction-rules-in-the-portal

does Azure ad v2Endpoint support API access other than the Microsoft Graph?

I cloned the node web api from https://azure.microsoft.com/en-us/resources/samples/active-directory-javascript-nodejs-webapi-v2/
An app was registered in the v2 app registration portal, with a webapi platform added and a web app with implicit flow set
When i browse to https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=5bab650d-e96c-4f30-a7e2-e6bbab2e7ab1&response_type=code&redirect_uri=http://localhost:5000/hello&response_mode=query&scope=api%3A%2F%2F5bab650d-e96c-4f30-a7e2-e6bbab2e7ab1%2Faccess_as_user%20openid%20offline_access
the browser is redirected to
localhost:5000/hello?error=invalid_client&error_description=AADSTS65005%3a+The+application+%27hand2%27+asked+for+scope+%27openid%27+that+doesn%27t+exist+on+the+resource.+Contact+the+app+vendor.%0d%0aTrace+ID%3a+4b3bdc12-9c1c-448b-abbb-704e9af80d00%0d%0aCorrelation+ID%3a+27afcaf6-cdac-428a-8c6b-7087ff8b34ef%0d%0aTimestamp%3a+2017-10-11+00%3a41%3a40Z
Any idea ?

Enabling security for Swagger UI on Service Fabric Web API Services

We enabled Swagger on Azure Service Fabric application using below link.
Swagger for Azure Service Fabric Stateless Web API application
But, we are unable to secure the swagger UI using OAuth (Azure AAD application). Can anyone please provide some guidance on enabling security on Swagger UI for the application hosted on Service Fabric.
Many Thanks, Thirumalai M
There isn't any real difference to how a Service Fabric hosted Web Api would handle this compare to a "normal" App Service or IIS hosted Web Api.
The following article does a good job of describing how to secure a Swagger UI using OAuth2 and IdentityServer3:
http://knowyourtoolset.com/2015/09/secure-web-apis-with-swagger-swashbuckle-and-oauth2-part-4/

Azure - Making an API App available to a Logic App

I've created a web application API with a swagger interface that I've deployed as an API App to Azure.
When creating a Logic App I can find my API App but whenever I try to use it I get the following error:
Failed to fetch swagger. Ensure you have CORS enabled on the endpoint
and are calling an HTTPS endpoint.
I'm using the default https url for the API definition in the API App:
https://microsoft-SOME-LONG-MS-INTERNAL-ID.azurewebsites.net/swagger/docs/v1
The swagger docs have been provided in my C# web API application through Swashbuckle.
For CORS I've set a single * item.
This didn't seem sufficient for the Logic App to access the API App I then configured Authentication / Authorization for the API App to use Azure Active Directory (express), creating an AD Azure App.
I believe the issue will be one of configuring security which is all pretty new to me in Azure. I'd like to make the API App inaccessible externally, but available to Web Apps and Logic Apps within my Azure subscription.
I've not added any authentication mechanism to the ASP.NET web application itself as I figured the web application would effectively be sitting in a private network on Azure. Perhaps this is a bad assumption and I need to add authentication to allow Azure AD to work?
Any pointers / suggestions?
Turns out I needed to update the Azure SDK for Visual Studio. I had an older version that was deploying a preview Api App which resulted in a "Api app host" type being deployed rather that an "API app" type.
Everything works after the update and I've found some documentation for securing the API App and making it available in the Logic App - https://azure.microsoft.com/en-us/documentation/articles/app-service-logic-custom-hosted-api/

Resources