Implement API Management Flashcards
When are the rate-limit-by-key and quota-by-key policies not avaliable in Azure API Management?
When using the consumption tier
How would you rate limit an IP to only 10 calls every minute?
rate-limit-by-key calls=”10”
renewal-period=”60”
counter-key=”@(context.Request.IpAddress)”
What’s the difference between a rate limit and a quota?
A rate limit are usually used to protect against short and intense volume bursts.
Quotas are used for controlling call rates over a longer period of time.
E.g. have 10,000 requests per month, but if you were to make 5,000 in 1 minute would overwhelm the service so we limit it to a 10 a minute.
If we were to run 10 requests per minute we’d run out of our quota in 16 hours but our service wouldn’t go down.
What PowerShell cmdlet would you use to create a new identity provider?
New-AzApiManagementIdentityProvider
Which PowerShell cmdlet would you use to create a new API Management instance?
New-AzApiManagement
Which PowerShell cmdlet would you use to create a new APIM API instance?
New-AzApiManagementApi
When an API has reached it’s usage quota what will the response be?
403 Forbidden
What response will an API return if it’s reached its limit of call rates?
429 Too Many Requests
Before an API can be consumed through a APIM what must be done first?
Added to a product in the Azure portal
When wanting to test changes of an API without publishing what should you do?
Create a revision.
What Powershell commandlet would you use to create an API Management Service? And then show it?
New-AzApiManagement -Name “myapim” -ResourceGroupName “myResourceGroup” `
-Location “West US” -Organization “Contoso” -AdminEmail “admin@contoso.com”
Get-AzApiManagement -Name “myapim” -ResourceGroupName “myResourceGroup”
What Azure CLI command would you use to create a new API Management Service? And then show the result
az apim create –name myapim –resource-group myResourceGroup \
- -publisher-name Contoso –publisher-email admin@contoso.com \
- -no-wait
az apim show –name myapim –resource-group myResourceGroup –output table
What xml snippet would be used for adding the header ‘Forwarded’ with the value of the host?
@(“host=” + context.Request.OriginalUrl.Host + “;”)
What do the four different API policies mean?
- inbound
- backend
- outbound
- on-error
< policies>
< inbound>
< !– statements to be applied to the request go here –>
< /inbound>
< backend>
< !– statements to be applied before the request is forwarded to
the backend service go here –>
< /backend>
< outbound>
< !– statements to be applied to the response go here –>
< /outbound>
< on-error>
< !– statements to be applied if there is an error condition go here –>
< /on-error>< /policies>
What policy statement should you add to authenticate with basic auth?
< authentication-basic username=”username” password=”password” />