Package: azure-defender-easm
Azure EASM Data Plane client library for PythonMicrosoft 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 DocumentationGetting startedInstalling the packagepippython-mpipinstallazure-defender-easmfrom sourcepythonsetup.pyintallPrerequisitesPython 3.7 or later is required to use this package.You need anAzure subscriptionto use this package.An existing EASM Data Plane Client instance.Create with an Azure Active Directory CredentialTo use anAzure Active Directory (AAD) token credential,
provide an instance of the desired credential type obtained from theazure-identitylibrary.To authenticate with AAD, you must firstpipinstallazure-identityAfter setup, you can choose which type ofcredentialfrom azure.identity to use.
As an example,DefaultAzureCredentialcan 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_SECRETUse the returned token credential to authenticate the client:fromazure.defender.easmimportEasmClientfromazure.identityimportDefaultAzureCredentialsub_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 conceptsBasic understanding these terms will help to get started with EASM client library.AssetsDefender EASM includes the discovery of the following kinds of assets:DomainsHostsPagesIP BlocksIP AddressesAutonomous System Numbers (ASNs)SSL CertificatesWHOIS ContactsThese 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.DiscoveryMicrosoft 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 GroupsCustom 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.ExamplesAfter 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 groupfromazure.defender.easmimportEasmClientfromazure.identityimportDefaultAzureCredentialsub_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 assetsfromazure.defender.easmimportEasmClientfromazure.identityimportDefaultAzureCredentialsub_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())forassetinclient.assets.list():print(f'{asset.kind}:{asset.name}')More examplesMore examples can be viewed in thesamples directoryof this repositoryTroubleshootingNext stepsContributingThis 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, visithttps://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 theMicrosoft Open Source Code of Conduct. For more information,
see the Code of Conduct FAQ or contactopencode@microsoft.comwith any
additional questions or comments.