Home
IT Hub

Configuring Microsoft Defender for API Security

Microsoft
Reco Security Experts
Updated
October 16, 2024
October 16, 2024

APIs (Application Programming Interfaces) have become integral components of modern software applications, facilitating seamless communication and integration between different systems. However, with the increasing reliance on APIs, security threats targeting them have also surged. Securing APIs is paramount to protecting sensitive data and ensuring the integrity of applications. Microsoft Defender offers robust tools and features to enhance API security within the Microsoft ecosystem. In this article, we'll explore the best practices for configuring Microsoft Defender specifically for API security.

Understanding Microsoft Defender for API Security

Microsoft Defender for API Security is a comprehensive solution designed to protect APIs hosted on Azure, including Azure Functions, Web Apps, and API Management services. It provides real-time threat protection, attack detection, and prevention capabilities to protect APIs against a wide range of threats, including OWASP Top 10 vulnerabilities, SQL injection, XSS (Cross-Site Scripting), and more.

7 Best Practices for Configuring Microsoft Defender for API Security

1. Enable Azure Defender

Azure Defender, previously known as Azure Security Centre, is an essential component for protecting Azure APIs. It provides unified security management and advanced threat protection across hybrid cloud workloads. By enabling Azure Defender, organizations can leverage its AI-driven capabilities to detect and mitigate security threats targeting APIs.

Steps to Enable Azure Defender:

  1. In the Azure portal, navigate to "Azure Defender" under "Azure Security Center."
  2. Click "Enable" to activate Azure Defender for all your resources.
  3. Customize the settings to fit your organizational needs.

The above image is of a detailed description of the properties in the Microsoft Entra ID Portal, focusing on managing vulnerabilities within Office 365, including settings and security features for API Security.

2. Implement API Management Policies

Azure API Management offers a rich set of policies that can be enforced at the API gateway level to enhance security. These policies include rate limiting, IP filtering, JWT (JSON Web Token) validation, and CORS (Cross-Origin Resource Sharing) enforcement. By configuring these policies, organizations can control access to APIs and prevent unauthorized access and abuse.

Steps to implement API management policies in Azure API Management using Microsoft Entra ID:

  1. Register an Application in Microsoft Entra ID:
    • Navigate to App registrations in the Azure portal.
    • Select New registration and provide a meaningful name for your application (e.g., backend app).
    • Choose the appropriate account types and leave the Redirect URI empty.
    • Record the Application (client) ID for later use.
    • Under Expose an API, set the Application ID URI with the default value.
    • If you’re developing a separate client app to obtain OAuth 2.0 tokens for access to the backend app, record this value as well.
  2. Enable Microsoft Entra ID in API Management:
    • In your API Management instance, go to the Developer portal.
    • Scroll down to Enable user sign-in with Microsoft Entra ID and select Enable Microsoft Entra ID.
  3. Configure the Validate-JWT Policy:
    • Configure the Validate-JWT policy in your API Management instance to validate the OAuth token presented in each incoming API request.
    • Valid requests can then be passed to the API.

Here is the overview of the API management console in Microsoft Entra ID, highlighting features for managing APIs, access controls, and security settings.

3. Enable Web Application Firewall (WAF)

Microsoft Defender for API Security includes a built-in Web Application Firewall (WAF) that protects against common web application attacks, such as SQL injection, XSS, and CSRF (Cross-Site Request Forgery). By enabling WAF, organizations can add a layer of defense to their APIs and mitigate the risk of web-based attacks like SQL injection and cross-site scripting. Web Application Firewall (WAF) provides centralized protection of your web applications from common exploits and vulnerabilities.

Here is the image of access control settings for the web application firewall in Microsoft Defender for API Security, showcasing configuration options and security features.

4. Use Threat Intelligence 

Microsoft Defender for API Security leverages threat intelligence from Microsoft Intelligent Security Graph to identify and block malicious IP addresses, domains, and URLs. By enabling threat intelligence, organizations can proactively block known malicious entities from accessing their APIs, reducing the risk of attacks and data breaches.

5. Implement Role-Based Access Control (RBAC) 

Azure offers Role-Based Access Control (RBAC) to control access to Azure resources, including APIs. By implementing RBAC, organizations can define fine-grained access policies and restrict access to APIs based on user roles and permissions. This helps prevent unauthorized access and limit the impact of security incidents.

6. Monitor and Audit API Activity

Continuous monitoring and auditing of API activity are essential for detecting and responding to security threats in real-time. Microsoft Defender for API Security provides comprehensive logging and monitoring capabilities, allowing organizations to track API usage, detect suspicious behavior, and investigate security incidents effectively.

Steps to Monitor and Audit API Activity:

  • Sign in to the Microsoft Entra admin center at entra.microsoft.com as an Authentication Policy Administrator.
  • Navigate to Identity and select Users > All users from the left-hand menu.
  • Click on Sign-in logs. You’ll see a list of sign-in events, including their status.

Above, you will see the Microsoft Entra ID Portal interface for administrators, showcasing navigation options and management features for user and security settings.

Use the URL entra.microsoft.com, click on users, and select the sign-in logs.

Here is an example of sign-in logs in the Microsoft Entra ID Portal, displaying user activity, timestamps, and access details for tracking login events.

Review the Following Key Metrics

Uses Description
Review IP address Review the IP address of your users.
Sign-in locations Review the locations and determine if anyone has signed in from a strange location to the user's mailbox.
Sign-in times The amount of times the user signs in.
Sign-in success or failure You can see if the user sign-in was successful or not.

7. Regular Security Assessments and Penetration Testing

Conducting regular security assessments and penetration testing is crucial for identifying and remediating API vulnerabilities. Microsoft Defender for API Security integrates with Azure Security Centre to provide automated security assessments and recommendations for improving API security posture. Additionally, organizations should perform manual penetration testing to identify and address potential security weaknesses.

Conclusion

Securing APIs is essential for protecting sensitive data, ensuring compliance, and maintaining application integrity. Microsoft Defender for API Security offers a robust set of tools and features to enhance API security within the Microsoft ecosystem. By following best practices and implementing recommended configurations, organizations can effectively mitigate security risks and protect their APIs against evolving threats.

Explore More
See more articles from our Hub

Start Securing Your Entire SaaS Lifecycle

Request a demo