Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Blogs / Learn with Subs / Unsure about policies with ...

Unsure about policies with Azure APIm? Copilot to the rescue

Subhad365 Profile Picture Subhad365 7 User Group Leader


Hey guys! Howz life?


Today we are gonna talk about some cool features available on Azure APIm, as a a part of Azure Copilot. If you are new to Azure APIm, and you don;t have much background as to how to weite a policy, what do they do actually, Azure Copilot can help you out.

Azure APIs are actually pretty famous way of inbounding, middlewaring and outbounding load from any 3rd party system to Azure. Azure API Management is a hybrid, multicloud management platform for APIs across all environments. As a platform-as-a-service, API Management supports the complete API lifecycle. You can write YAML based policies statements that can govern a lot of things, like parsing an incoming a JSON payload, forwarding the call to another 3rd party URL, or managing number of calls per sec -- only to name a very, very few. 

You can create An Azure APIm very easily: just crawl up to the usual home of https://portal.azure.com and 

a. Create An Azure API by searching for 'API management services' >> Create: the following Screen will appear. 



Select a resource group/create a new one. Give a proper resource name and select 'Pricing tier' as  'Developer', which is absolutely fine for development purpose. Rest all else you can leave as is, and click on Review + create >> Create. Azure APIs take at least half an hour to 45 mins to get deployed and get itself ready.


b. Once the API is ready, typically it looks like:





Click on API as highlighted and it will take you to the following section, where you could see a list of default APIs been created:





Along with that you can see self explanatory sections like Inbound, Outbpund, backend and frontend, where you can stage your API calls through various activities like posting or getting the contents of a response, forwarding the response to another URL, securing your APIs, etc.

Now, here comes the action.

Click on Copilot on the top: allowing the chat window to open on your right hand section:





You can ask the copilot to type for you the necessary policies, which you are not sure of. Suppose, you want to restrict the call limit of your API. So I got the reply like this:




It's giving me the policy syntax, which you can copy from the clipboard, by clicking on the red icon shown.
Open Azure APIm policies, by clicking on the section shown:




The following screen opens up; paste your copied code as shown highlighted, right below the <base /> tag:



Save you policy now.


If you are unsure of how to implement jwt token (explained on another post: https://subsd365.blogspot.com/2023/06/enabling-oauth2-to-protect-your-azure.html), you can ask the same thing to copilot, and you can get the answer like this:



Of course, you can copy the policy and paste it in your Azure APIm, so as to enable the OAuth2 features in your API.


See: this time, I didn't mention 'on Azure API', Copilot understands I am talking about Azure API, by referring to ChatGPT4.0's understanding conversational context feature

Another amazing example of Copilot on Azure API is, suppose, when you click on 'Show snippet' section:



The following drop dialog window will open:


Suppose, you want to arrest a certain range of IPs to access your API. You need to choose 'Restrict Caller IPs' as shown highlighted:



This will give your API a policy like this:




If you are unsure of what is the meaning of this policy, you can select the policy and right click:




And this will open the policy on Copilot and will explain you the policy details:




Whew!!! Yeah,  Copilot can just not write policies for you, but can help you understand things.  


Well, So much much for today -- will come back with more on Copilots on another post. Stay tuned, much love and namaste 💓💓💓

Comments

*This post is locked for comments