Hardening API Management: the basics
What does a weakly governed Azure API gateway actually look like?
Azure API Management is the front door to a lot of an organisation's data and logic, and weakness shows up in a handful of distinct shapes rather than one setting. An endpoint can be published with no authentication at all, so anyone who finds the URL can call it. APIs can be invisible to threat detection because they were never onboarded to Defender for APIs. Old endpoints that stopped receiving traffic can be left active long after they should have been retired. A subscription key can be scoped to all APIs instead of one product. The gateway can call its backends with certificate validation switched off, the deprecated direct management endpoint can still be enabled, and secret named values can sit as encrypted strings inside API Management instead of in Key Vault. Each is its own Defender for Cloud recommendation, but the underlying risk is the same: an API surface that is more reachable, less observed, or more trusting than you intended.
Microsoft Defender for Cloud, through its Defender for APIs plan and CSPM posture checks, turns each of these into its own recommendation, which is why one API-heavy subscription can fail several gateway checks at once. 'API endpoints in Azure API Management should be authenticated' and 'Azure API Management APIs should be onboarded to Defender for APIs' are the two that matter most, because the first closes the widest door and the second is what lets Defender see the traffic at all. They pair with the least-privilege, backend-trust, management-plane and secret-storage recommendations to form a single capability. They read as separate problems on the report, but they are one job: make every endpoint authenticated and observed, and stop the gateway from trusting anything it should not.
Most of this is drift, not intent. An API imported for a quick proof of concept that never had a policy attached, an instance that pre-dates Defender for APIs, a subscription left scoped to all APIs because that was the fastest way to unblock a test, a backend where someone disabled certificate validation to get past a self-signed cert and never re-enabled it. The work is to find every endpoint and setting that is weaker than intended, decide which exceptions are genuine, and bring the rest up to a consistent, enforced baseline.
In this lesson you will learn how Azure API Management expresses authentication, observability, least privilege and backend trust, how to find every weakly governed endpoint and setting in an instance, and how to bring them up to a consistent baseline without breaking live integrations. The Controls this lesson covers section lists every Defender for Cloud recommendation in this capability, each linking to a deep page with the exact check and a copy-and-paste fix.
The endpoint nobody was watching
A large share of reported API breaches trace back to two boring root causes: an endpoint that should have required authentication but did not, and an old API that should have been retired but was quietly left running without current security coverage. The industry shorthand for the second one is the 'zombie API', an endpoint still reachable long after the team forgot it existed. Defender for APIs flags any endpoint that has seen no traffic for 30 days for exactly this reason: the APIs you have stopped thinking about are the ones an attacker is most likely to find first.
Finding gateway weakness across an instance
Priya is the platform lead at a fintech preparing for a SOC 2 audit. Defender for Cloud shows API Management findings spread across two instances: some APIs are unauthenticated, several have not been onboarded to Defender for APIs, and a handful of endpoints have seen no traffic in over a month.
Rather than work the findings one by one, Priya starts by listing every API in the instance and how it is secured, so the genuinely public-by-design endpoints can be separated from drift before anything changes.
Start by listing the APIs in an instance and whether each one requires a subscription key. APIs with subscriptionRequired false and no other auth policy are the widest-open doors.
subscriptionRequired false is not automatically a finding: the API may validate a JWT or client certificate in policy instead. But an endpoint with neither a subscription key nor a validation policy is the highest-value target in this group. Fix these first.
How Defender for Cloud decides an API gateway is weakly governeddeep dive
The recommendations resolve to a few different layers of the service. Authentication is assessed at runtime: Defender for APIs checks whether an endpoint requires a subscription key (for APIs or products where subscription is required) or executes a policy that validates a JWT, a client certificate or a Microsoft Entra token. If none of those mechanisms runs during the call, the endpoint is marked unauthenticated. Observability is a plan-level fact: 'Azure API Management APIs should be onboarded to Defender for APIs' is unhealthy until you both enable the Defender for APIs plan on the subscription and onboard each API's collection, after which Defender begins inspecting traffic. Usage is traffic-based: an endpoint that has received no calls for 30 days is flagged as unused, because forgotten endpoints rarely get current security attention.
Least privilege and backend trust are configuration facts on the resource. A subscription whose scope is the whole service or all APIs, rather than a single product or API, triggers the least-privilege recommendation. A backend whose 'tls' block has 'validateCertificateChain' or 'validateCertificateName' set to false triggers the certificate-validation recommendation, because that gateway will trust a backend it should reject. The direct management endpoint recommendation fires when the deprecated management API is enabled on the instance, an endpoint that bypasses Azure Resource Manager role-based access control and throttling, and which Microsoft retired on 15 March 2025, so the only correct action is to disable it. Secret named values stored as encrypted strings inside API Management, rather than as Key Vault references, trigger the secret-storage recommendation.
Several of these are evaluated against the Microsoft Cloud Security Benchmark on a periodic cycle, so a fix does not flip a recommendation to Healthy instantly: the control-plane change is immediate, but the posture catches up on the next assessment, and the Defender for APIs detections need traffic to flow before they show value. The strongest position combines the per-resource fix with an Azure Policy backstop in audit or deny mode, so no new instance can be created with the management endpoint enabled, certificate validation bypassed, or secrets left out of Key Vault. The Logic Apps equivalents, authentication on Logic Apps API endpoints and retiring unused Logic Apps endpoints, are in preview and apply the same authenticated-and-observed logic to workflow-hosted APIs.
What is the impact of leaving the gateway weakly governed?
The direct impact is data exposure and abuse. An unauthenticated endpoint is callable by anyone who finds the URL, and API endpoints are enumerated quickly by automated scanners, so an open endpoint that fronts data is an exfiltration path. An API that was never onboarded to Defender for APIs is one nobody is watching, so anomalous or malicious traffic against it produces no alert. A subscription key scoped to all APIs turns a single leaked key into access across the whole gateway rather than one product. A backend call with certificate validation disabled is open to a man-in-the-middle that the gateway will silently trust.
The second-order impact is blast radius and invisibility. Every unauthenticated, unwatched or over-scoped endpoint is attack surface that has to be defended continuously, and the forgotten endpoints are the worst because nobody is looking at them. Hardening the gateway shrinks that surface to the APIs you actually operate and authenticate, and onboarding them to Defender for APIs means the traffic you do allow is finally being inspected, so an attack produces a signal instead of silence.
On the compliance side, every modern framework, ISO 27001, SOC 2, PCI DSS, HIPAA and the UK and EU data-protection regimes, expects evidence that exposed interfaces enforce authentication, follow least privilege, and are monitored. A passing set of API Management recommendations across every subscription, with Defender for APIs enabled on the APIs that handle real data, is a defensible artefact to hand an auditor and a genuine reduction in the most exposed layer you run.
How do you harden API Management safely?
Work the capability as one loop rather than chasing individual findings. The order matters: get visibility and authentication in place before you start retiring or re-scoping things, so you do not break a live integration that a partner depends on.
1. Onboard to Defender for APIs and inventory every endpoint
Enable the Defender for APIs plan on the subscription and onboard each instance's APIs so traffic is being inspected, then list every API, how it is authenticated, when it last received traffic, and how its subscriptions are scoped. Treat this inventory as the source of truth, not the Defender finding count, because one instance can trigger several recommendations at once.
2. Authenticate every endpoint, separate the genuine exceptions
For each endpoint with no subscription key and no validation policy, attach authentication: require a subscription key, or add a validate-jwt or validate-client-certificate inbound policy. The rare endpoint that is public by design, an open webhook or a health probe, should be a documented exception that is rate-limited and put behind a web application firewall, not left as silent drift.
3. Retire zombies and tighten least privilege
Remove endpoints that have seen no traffic for 30 days once you have confirmed they are genuinely dead, and re-scope any subscription that is scoped to all APIs down to the single product or API it actually calls. The same applies to unused Logic Apps API endpoints, which Defender now flags in preview.
4. Close the trust gaps and ratchet with Azure Policy
Re-enable backend certificate chain and name validation, disable the deprecated direct management endpoint, and move secret named values from encrypted strings into Key Vault references behind a managed identity. Then assign Azure Policy to audit or deny these states on any future instance, so the safe configuration is enforced rather than merely encouraged.
# 1. Enable the Defender for APIs plan on the subscription so onboarded APIs are inspected.
az security pricing create --name Api --tier Standard
# 2. Disable the deprecated direct management endpoint (retired 15 March 2025).
# 'customProperties' on the service controls this gateway behaviour.
az apim update --name apim-prod --resource-group rg-platform \
--set 'properties.customProperties."Microsoft.WindowsAzure.ApiManagement.Gateway.ManagementEndpoint"=false'
# 3. Re-enable backend certificate chain and name validation on a backend that
# had it switched off. There is no native 'az apim backend' TLS flag, so PUT
# the documented 'tls' block via the management API (api-version 2024-05-01).
sub=$(az account show --query id -o tsv)
az rest --method put \
--uri "https://management.azure.com/subscriptions/$sub/resourceGroups/rg-platform/providers/Microsoft.ApiManagement/service/apim-prod/backends/payments-backend?api-version=2024-05-01" \
--body '{"properties":{"url":"https://payments.internal/","protocol":"http","tls":{"validateCertificateChain":true,"validateCertificateName":true}}}'
# 4. Ratchet it shut: audit any instance whose management endpoint stays enabled.
# Look the built-in policy up by display name; never hardcode a definition GUID.
pid=$(az policy definition list \
--query "[?displayName=='API Management direct management endpoint should not be enabled'].name" -o tsv)
az policy assignment create \
--name audit-apim-mgmt-endpoint \
--policy "$pid" \
--scope "/subscriptions/$sub" Quick quiz
Question 1 of 5Defender for Cloud shows API Management findings across authentication, Defender onboarding, unused endpoints and subscription scope on one instance. What is the most efficient way to think about them?
You scored
0 / 5
Keep learning
Go deeper on how Azure API Management expresses authentication, observability and backend trust across the settings in this capability.
- Protect APIs in API Management with Defender for APIs How to enable the Defender for APIs plan and onboard your APIs so traffic is inspected.
- Subscriptions in Azure API Management How subscription scope works and why an all-APIs scope breaks least privilege.
- Use named values, including Key Vault references How to move secret named values into Key Vault behind a managed identity.
You can now treat Azure API Management as one capability rather than a scatter of findings: onboard your APIs to Defender for APIs so traffic is watched, authenticate every endpoint, retire the zombies, scope subscriptions to least privilege, close the backend and management-plane trust gaps, and ratchet the estate with Azure Policy. The Controls this lesson covers section below links every recommendation in this group to its deep page and fix.
Back to the library