Azure API Management Overview and Features
Azure API Management Overview and Features
APIs
API governance and usage defines success
API
Developer portal
Discover Abstract
Learn Secure
Try Evolve
Onboard Observe
App Management API
Get help plane Monetize
developers providers
User plane
Gateway
Employees
Partners Data plane
Customers
Apps
on devices
(micro)services
Fully-managed serverless and dedicated tiers
Consumption tier Developer | Basic | Standard | Premium tier
No infrastructure to provision or manage No infrastructure to provision or manage
Curated set of features and usage limits Full set of features. Not governed.
Azure Application Platform
Application platform
API Management
Integration
Events Messaging
App VS Code GitHub Application
Developer package
Azure Serverless Azure Kubernetes Service
Management
Gartner named Microsoft a leader in 2021 Gartner Magic Quadrant for Enterprise iPaaS
API management is key in digital business ecosystem
Marketplace of apps for employees, partners, and customers
End users
More productive and satisfied
Power Apps employees, partners, and customers
Extend innovation with citizen developers through easy
discovery and consumption of custom APIs
IT pros
Able to govern all APIs and Apps
47%
35%
18K
API calls per annum Americas EMEA APAC
87% YoY growth
Customers
38% YoY growth
Gartner named Microsoft a leader in 2021 Gartner Magic Quadrant for Full Life Cycle API Management
Azure API Management Customers
Full API lifecycle
Design
Analyze Develop
Monitor Secure
Scale Publish
Design
Analyze Develop
Scale Publish
Code- and design-first approaches to building APIs
API Management supports both approaches to building APIs:
Code-first approach
Implement the API and generate the API specification as an afterthought (i.e. with Swashbuckle)
Benefits:
More convenient for API developers
The only option for existing APIs
Design-first approach
Create an API specification, review it with stakeholders, and implement the API
Kickstart development by scaffolding the code from the API specification
Benefits:
Better API consumer experience thanks to the deliberate API design
Reduced risk thanks to the API review processes
Create an API
API
200 OK
{
“message”: “example”
}
WebSocket API support
Gateway
WebSocket WebSocket
Features
CRUD WebSocket APIs
Apply policies to handshake requests
Browse WebSocket APIs in the Developer portal
Test WebSocket APIs in the Azure and Developer portals
Azure Monitor metrics and logs
GraphQL API support (Public preview)
Passthrough support for GraphQL APIs
CRUD existing GraphQL APIs via Azure portal and management API
Explore the schema and run test queries in the Azure and developer portals
Apply existing access control policies
Apply a new 'validate-graphql-request' policy to protect against GraphQL-specific attacks
Query validation
Field-based authorization
Query depth and size restriction
Design
Analyze Develop
Scale Publish
There’s a policy for that
Encapsulate common API management functions
Access control, Protection, Transformation, Caching, …
[Link]
Policy scopes
/foo api
/bar operation
to caller
from backend
C# “snippets” used with policies
Have read-only access to the request context
Use only whitelisted .NET types
Used to configure and conditionally execute policies
53 policies out of the box
Access restriction Transformation Advanced Dapr integration
• Check HTTP header • Convert JSON to XML • Send one way request • Send request to a service
• Limit call rate by subscription • Convert XML to JSON • Send request • Send message to a pub/sub topic
• Limit call rate by key • Find and replace string in body • Set HTTP proxy • Trigger output binding
• Restrict caller Ips • Mask URLs in content • Set variable
• Set usage quota by subscription • Set backend service • Set request method
• Set usage quota by key • Set body • Set status code
• Validate client certificate • Set HTTP header • Control flow
• Validate JWT • Set query string parameter • Emit metric
• Rewrite URL • Log to Event Hub
• Transform XML using XSLT • Trace
• Mock response
• Forward request
• Limit concurrency
• Return response
• Retry
• Wait
• Authenticate with basic • Get from cache • Allow cross-domain calls • Validate content
• Authenticate with client certificate • Store to cache • CORS • Validate parameters
• Authenticate with managed identity • Get value from cache • JSONP • Validate headers
• Store value from cache • Validate status code
• Remove value from cache • Validate GraphQL request
Integration policies
<send-request/>
Response composition (or gateway aggregation)
One client request -> multiple backend requests
Data lookup, complex content transformation, payload or credential validation
Typical pattern:
1. externalize logic as an HTTP endpoint
2. make a call
3. cache the result
<send-one-way-request/>
Traffic mirroring
Coordinate callouts with <wait> for all or any outstanding requests
<log-to-eventhub/>
Event Hub is widely supported within Azure
Custom reporting, batch analytics, archiving, audit
Customer has full control over what is logged, when it is logged and owns the data
We employ buffering (e.g. 200MB per node in Premium)
Delivery is not guaranteed – comprehensive set of metrics is available
It’s crucial to adequately scale the target Event Hub
Co-location in the region is highly recommended
Request forwarding
<forward-request/>
Usually inherited from the global scope via <base/>
No policy, no forwarding
Timeout can be set to 30 sec – 10 min (default is 5 min)
Can be configured to follow redirects or (default) return them to caller
<retry/>
<limit-concurrency/>
Caps the number of concurrent requests forwarded to the backend
Can be used with other policies - limits the number of requests entering enclosed policies
<set-backend-service>
Change backend service during runtime
Can be configured with conditional policies for blue/green deployment
Caching
Distributed Redis cache hosted as part of service instance (not available in the Consumption tier)
Shared among all units within a region
Not persistent and thus gets lost during service updates
No preloading
<rate-limit-by-key/>
Number of calls allowed in short interval (usually 1 sec)
Enforced per region
Key expression specifies throttling semantics, e.g. caller IP, subscription ID, developer ID
Uses sliding time window, i.e. last 5 seconds
Counts every request or only the ones that meet specified condition, e.g. only 200 OK
Different requests can be weighted differently, e.g. based on cost to the backend
Legacy <rate-limit/> == <rate-limit-by-key/> with subscription ID as a key
<quota-by-key/>
Total number of calls and/or bytes per time period (usually hour, day, week, month)
Enforced per service instance
Key expression specifies throttling semantics, e.g. caller IP, subscription ID, developer ID
Uses calendar time
Counts every request or only the ones that meet specified condition, e.g. status < 400
Different requests can be weighted differently, e.g. based on value provided to the caller
Legacy <quota/> == <quota-by-key/> with subscription ID as a key
Authentication
Authentication using subscription keys is supported out-of-the-box without configuring policies
<validate-jwt>
validates JSON Web Tokens
Supports JWS and JWE (RSA256 and HS256)
Supports Open ID Configuration endpoint
Can also check specific claims
Can be configured at any policy scope
<validate-client-certificate>
Enforce that a certificate presented by a client matches the specified validation rules and claims, such as subject, thumbprint, or issuer
Transformation
<set-header> and <set-query-parameter>
Add/remove/modify headers and query parameters of incoming and outgoing requests
<set-body>
Set the payload of incoming and outgoing requests
<rewrite-url>
Convert request URL from its public form to the form expected by the backend service
<find-and-replace>
Find and replace substrings in the payload of incoming and outgoing requests
<xsl-transform>
Applies XSL transformation to XML in the payload of incoming and outgoing requests
Validation
<validate-content>
Validates the size or JSON schema of a request or response body against the API schema
<validate-parameters>
Validates the header, query, or path parameters in requests against the API schema
<validate-headers>
Validates the responses headers against the API schema
<validate-status-code>
Validates the HTTP status codes in responses against the API schema
<validate-graphql-request>
Validates and authorizes a request to a GraphQL API
Visual Studio Code
Designed to increase productivity
Policy debugging
Problems
Automate deployment of APIs into API Management
Migrate configurations from one environment to another
Avoid interference between development teams
Production Development
Analyze Develop
Scale Publish
API Management to the rescue
# OWASP API Top 10 (2019) Mitigations and preventive measures in API Management
1 Broken Object Level Authorization
Developer portal
Data plane
Backend APIs
Gateway
Apps on devices
Data plane security
Enforce claims
JWT
Require signatures and expiration time
Quota
Throttling Calls and data transfer
Approximate
Per service
Key expression defines throttling semantics
Can count requests with specific status code
Variable increment count
Concurrency limit
Precise
Per node
Filter or mask confidential data
Response
Standardize error messages
sanitization
Remove sensitive headers
Use request and response validation
policies to protect your APIs from
Request and vulnerabilities
response
validation
Excessive DoS large
Mass
data Injection payload
assignment
exposure attack
OWASP API Top 10 OWASP API Top 10 OWASP API Top 10
Validation policies
Four policies
Validate content - validates the size or JSON schema of a request or response body against the API schema
Validate parameters - validates the request header, query, or path parameters against the API schema
Validate headers - validates the response headers against the API schema
Validate status code - validates the HTTP status codes in responses against the API schema
Mitigation
Set the “additionalProperties” option of request objects’ JSON schemas to false
Precisely define request object schemas in the API specification and enforce them with the validate-content policy
Mitigation
Provide format properties, like regex for text fields, in the API specification’s object schemas and enforce them with the
validate-content policy
Mitigation
Set the “additionalProperties” option of response objects’ JSON schemas to false
Precisely define response object schemas in the API specification and enforce them with the validate-content policy
Define all allowed response status codes in the API specification and enforce them with the validate-status-code policy
Precisely define all allowed response headers in the API specification and enforce them with the validate-headers policy
Mitigation
Enforce maximum request content size with the content-validation policy
API
Management
API providers plane
Azure Resource
Manager
Azure portal
Resource Manager templates
PowerShell Azure account (Azure AD)
Azure CLI Built-in roles
Client SDKs Custom roles
Visual Studio/Code extensions
Terraform templates
“User plane” security
App developers
Developer portal
Employee developers
Partner developers
Customer developers Work and internet accounts
Public developers Integration with Azure AD B2B/B2C
Custom (delegated) authentication
Native and Azure AD groups
Self-service or invite-only onboarding to API products
Auto or manual approval of subscriptions
Limits on the number of subscriptions
Subscription suspension and revocation
Compliance
Meets a multitude of global, regional, country and industry specific regulations
ISO 27001
PCI DSS
HIPAA
FedRAMP High
GDPR
…
API
Developer portal
Backend APIs
Gateway
Apps on devices
Analyze Develop
Scale Publish
Developer portal is a discovery and self-onboarding point for
application developers
Built-into API Management Open the portal within seconds; updates are on us.
Easily customizable Author content and brand the portal with a drag-and-drop visual editor.
Open-source Browse the codebase and engage with the community on GitHub.
Extensible Extend the codebase with custom logic and self-host the resulting portal.
Revisions Versions
For non-breaking changes For breaking changes
Providers choose when to deploy Consumers choose when to adopt
API requests default to current revision Specify with URL path, query, or header param
Test by specifying revision ID, then promote
Versions and revisions
Domain API Version
Operation Revision
;rev=1
/v1
;rev=2
;rev=3
/speakers
;rev=4
[Link] foo /sessions
/days
;rev=1
/v2 /events
;rev=2 /speakers
offline /sessions
online /venues
current
Bundle APIs with products
Developer portal
Management plane
API 2
Manage products and API associations
Define product-scoped policies
Approve and manage subscriptions
API 3 Collect and analyze usage data
Monetize access
API 4 Gateway
Analyze Develop
Scale Publish
Worldwide presence
44 public regions in Americas, Europe, Asia, Australia, Africa
6 US Government regions
4 regions in China
Nodes in a gateway location share configuration – e.g., APIs, domain names, certificates
Distributed deployment
Virtual network
…
Dapr integration policies
Sidecar Sidecar
Management Plane App 1 pod App 2 pod App 1 pod App 3 pod
Restore
Could take as long as 30 min or more depending on the size
Instance is not available while restore is in progress
Custom domain configuration need to be re-applied manually
Self-troubleshoot
Built-in automated troubleshooting experiences in the Azure portal
Extensive documentation on Azure Docs
Analyze Develop
Scale Publish
Monitor and analyze features
Tech Reporting Monitoring Debugging Data lag Retention Sampling Data schema Data kind Enabled
Turned on Fixed
API inspector - - Good Instant Last 100 traces Request trace Always
per request can be extended
Built-in Reports
Good - - Minutes Unspecified 100% Fixed Always
reports Logs via API
Azure
93 days
Monitor Basic Good - Minutes 100% Fixed Metrics Always
export to extend
Metrics
Log to Event
Custom Custom Custom Seconds User managed Custom Custom Logs Optional
Hub
API Inspector
Request scoped trace
Turned on per request
Fixed schema (can be extended)
Azure Monitor
metrics
Aggregated metrics
Always-on
Samples all requests
93-day retention
Alerts and notifications
Azure Monitor logs
Request scoped logs
Opt-in
Adjustable sampling
Fixed schema (can be extended)
31-day retention (5GB)
Built-in query experience
Application Insights
Request scoped traces
Opt-in
Adjustable sampling
90-day retention (5GB)
Distributed tracing
Built-in reports
Out-of-the-box
Always-on
Rich report types
Access via Azure portal or API
Custom analytics and reporting
Machine Learning SQL Database
Hadoop Storage
Business users
(Azure account is not required)
Gateway
Data plane
Apps
on devices (micro)services
Event Grid integration
Events publisher Events subscribers
Logic App
Function App
API
Event Grid Webhook
Management
(stdout)
Azure API Management
Mature full life cycle API management solution
Design
Trusted by thousands of enterprise customers
Low-barrier-to-entry pricing
Resources [Link]
Questions