Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Azure EASM Data Plane client library for Python

Microsoft Defender External Attack Surface Management (Defender EASM) continuously discovers and maps your digital attack surface to provide an external view of your online infrastructure. This visibility enables security and IT teams to identify unknowns, prioritize risk, eliminate threats, and extend vulnerability and exposure control beyond the firewall. Defender EASM leverages Microsoft’s crawling technology to discover assets that are related to your known online infrastructure, and actively scans these assets to discover new connections over time. Attack Surface Insights are generated by leveraging vulnerability and infrastructure data to showcase the key areas of concern for your organization.

Source Code | Package (pypi) | Api Reference Documentation | Product Documentation

Getting started

Installing the package

pip

python -m pip install azure-defender-easm

from source

python setup.py intall

Prerequisites

  • Python 3.7 or later is required to use this package.
  • You need an Azure subscription to use this package.
  • An existing EASM Data Plane Client instance.

Create with an Azure Active Directory Credential

To use an Azure Active Directory (AAD) token credential, provide an instance of the desired credential type obtained from the azure-identity library.

To authenticate with AAD, you must first pip install azure-identity

After setup, you can choose which type of credential from azure.identity to use. As an example, DefaultAzureCredential can be used to authenticate the client:

Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET

Use the returned token credential to authenticate the client:

from azure.defender.easm import EasmClient
from azure.identity import DefaultAzureCredential

sub_id = '<your subscription ID here>'
workspace_name = '<your workspace name here>'
resource_group = '<your resource group here>'
region = '<your region here>'

endpoint = f'{region}.easm.defender.microsoft.com'

client = EasmClient(endpoint, resource_group, sub_id, workspace_name, credential=DefaultAzureCredential())

Key concepts

Basic understanding these terms will help to get started with EASM client library.

Assets

Defender EASM includes the discovery of the following kinds of assets:

  • Domains
  • Hosts
  • Pages
  • IP Blocks
  • IP Addresses
  • Autonomous System Numbers (ASNs)
  • SSL Certificates
  • WHOIS Contacts

These asset types comprise your attack surface inventory in Defender EASM. This solution discovers externally facing assets that are exposed to the open internet outside of traditional firewall protection; they need to be monitored and maintained to minimize risk and improve an organization’s security posture. Microsoft Defender External Attack Surface Management (Defender EASM) actively discovers and monitors these assets, then surfacing key insights that help customers efficiently address any vulnerabilities in their organization.

Discovery

Microsoft Defender External Attack Surface Management (Defender EASM) relies on our proprietary discovery technology to continuously define your organization’s unique Internet-exposed attack surface. Discovery scans known assets owned by your organization to uncover previously unknown and unmonitored properties. Discovered assets are indexed in a customer’s inventory, providing a dynamic system of record of web applications, third party dependencies, and web infrastructure under the organization’s management through a single pane of glass.

Discovery Groups

Custom discoveries are organized into Discovery Groups. They are independent seed clusters that comprise a single discovery run and operate on their own recurrence schedules. Users can elect to organize their Discovery Groups to delineate assets in whatever way best benefits their company and workflows. Common options include organizing by responsible team/business unit, brands or subsidiaries.

Examples

After authenticating as shown in the "Create with an Azure Active Directory Credential" section, you can get started building your inventory like this:

Create a discovery group

from azure.defender.easm import EasmClient
from azure.identity import DefaultAzureCredential

sub_id = '<your subscription ID here>'
workspace_name = '<your workspace name here>'
resource_group = '<your resource group here>'
region = '<your region here>'

endpoint = f'{region}.easm.defender.microsoft.com'

client = EasmClient(endpoint, resource_group, sub_id, workspace_name, credential=DefaultAzureCredential())

client.discovery_groups.put("example group", {
	'seeds': [
	    {'kind': 'host', 'name': 'example.org'}
	]
})
client.discovery_groups.run("example group")

View assets

from azure.defender.easm import EasmClient
from azure.identity import DefaultAzureCredential

sub_id = '<your subscription ID here>'
workspace_name = '<your workspace name here>'
resource_group = '<your resource group here>'
region = '<your region here>'

endpoint = f'{region}.easm.defender.microsoft.com'

client = EasmClient(endpoint, resource_group, sub_id, workspace_name, credential=DefaultAzureCredential())

for asset in client.assets.list():
	print(f'{asset.kind}: {asset.name}')

More examples

More examples can be viewed in the samples directory of this repository

Troubleshooting

Next steps

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Metadata

Release files for azure-defender-easm 1.0.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for azure-defender-easm 1.0.0b1
File Size Uploaded
azure-defender-easm-1.0.0b1.zip 119.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for azure-defender-easm 1.0.0b1
File Interpreter ABI Platform
azure_defender_easm-1.0.0b1-py3-none-any.whl Python 3 none any Details

Total release size: 216.0 kB

Release files / azure-defender-easm-1.0.0b1.zip

Download URL azure-defender-easm-1.0.0b1.zip
Size 119.8 kB
Tags Source
SHA-256 checksum
How to use checksums
524b0fe0f561b69215fc18ebca1010dbba843daaeb27ca579b0a9924c287e4a7
BLAKE2b-256 checksum
How to use checksums
4d55adc063793cd4962493b6fa3bb96b4bb6a92391e89c6c575b2fb1aa77049e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.28.2 setuptools/58.1.0 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.9.16

Release files / azure_defender_easm-1.0.0b1-py3-none-any.whl

Download URL azure_defender_easm-1.0.0b1-py3-none-any.whl
Size 96.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6017b4c42b5bb7109936e39772f412759b0faf36f3cfddddbe1b46cf3a90696
BLAKE2b-256 checksum
How to use checksums
6ff27d95e9d7006c8556ffbf456f69192505c1e27d297b5357901532281e176e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.28.2 setuptools/58.1.0 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.9.16

Release history Release notifications | RSS feed

This release

1.0.0b1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page