What is Azure API Management?
- Azure API Management is a cloud-based service provided by Microsoft that enables developers to create, manage, and secure APIs. It acts as a gateway that allows developers to expose their APIs to the outside world in a secure and scalable way.
- API Management provides a variety of features such as authentication, rate limiting, caching, and logging, among others, which help developers to manage the entire lifecycle of their APIs. It also provides analytics and monitoring capabilities to help developers to gain insights into their API usage and performance.
- Azure API Management is designed to work seamlessly with Azure services, including Azure Functions, Azure Logic Apps, and Azure App Service. It also provides integration with popular third-party tools such as Swagger, Postman, and Visual Studio Code.
- In combination with ASP.NET Core, Azure API Management allows developers to build scalable and reliable APIs quickly and easily. By leveraging the capabilities of Azure API Management, developers can focus on building the core logic of their APIs, while leaving the management of the APIs to the service.
Here we do a complete demo of how AZURE API MANAGEMENT works with ASP.NET CORE.
- Create Asp.net core API Project using visual studio 2022.
- Go to Azure Portal https://portal.azure.com/.
- Search API Management services.
- Click on Create button to create API Management services.
- Click on the Review + Create button to create the resource.
- It takes time to create the resource.
- Go to resource and Click on API from the side menu.
- Click on Open API.
- Run your API Project in Visual Studio 2022.
- Publish your API to Azure window service.
- Go to the browser and paste this /swagger/v1/swagger.json.
- Press enter its shows a JSON form of API.
- Copy the complete URL and paste it OPEN API Specification.
- Click on Create Button to create the API.
- Go to the test tab and click on send button you see the JSON response of API.
- Now you test the API through Postman.
- You see the message that “Access denied due to missing subscription key“.
- So if we want to share this API with someone we also need to share the subscription key.
- To get the subscription key go left menu and select the subscription menu.
- Click on Add button to create a subscription key for a specific API.
- After the subscription key add you see the name of your subscription.
- Click on three dots and click to show/hide and copy the primary key.
- Go to Postman add this key in header “Ocp-Apim-Subscription-Key” and paste your primary key in the value.
- Now you see the response with status code 200.
Thanks for reading the blog. If you have any questions please drop your message on the contact us page.