Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information in this article relates to a prereleased product which may be substantially modified before it's commercially released. Microsoft makes no warranties, expressed or implied, with respect to the information provided here. Perception is currently in limited public preview. The limited public preview program means Perception is available to a small, invitation-only set of customers for a defined preview window before broader public availability.
Set up the Web App Pen Test Agent to make approved web applications available for authorized penetration testing. An administrator enables the agent and adds target domains. A DNS administrator publishes a verification record to demonstrate control of each domain.
This article covers administrative setup, permissions, domain ownership verification, target preparation, and optional setup for Protect web app. To choose a scenario, run Run web pen test or Protect web app, and review findings, see Use the Web App Pen Test Agent.
Warning
The agent performs active security testing. Testing can affect application availability, data, and user workflows. Test only applications you own or are explicitly authorized to assess. Domain ownership verification doesn't replace authorization, change management, or operational monitoring.
Before you begin
You need:
- A tenant with Perception set up and access to the Web App Pen Test Agent preview. See Get started with Perception.
- Microsoft Defender XDR enabled in the tenant.
- The permissions listed in Required permissions below.
- An internet-reachable web application that your organization owns or is explicitly authorized to test.
- Access to DNS administration for each domain you need to verify, or a DNS administrator who can publish a TXT record.
- An application owner or security contact who can approve the assessment scope, test accounts, testing window, monitoring, and stop procedure.
For your first assessment, use a controlled nonproduction or quality-assurance application. Use test data and least-privileged test accounts rather than real-user accounts and workflows.
Required permissions
The preview setup and operating roles are separate from ownership verification:
| Activity | Required access |
|---|---|
| Set up the agent, configure it, and manage approved targets | Security Administrator |
| Run sessions or review results | Security Reader or higher, with access to the agent |
| Publish the domain verification record | Permission to create TXT records in the target domain's DNS zone |
| Configure an optional Azure Web Application Firewall exception | Administrative access to the relevant firewall or Web Application Firewall |
| Inspect Azure resources for Protect web app | Azure Reader on each subscription to inspect, assigned to the Web App Risk Reduction Agent runtime identity, not the user running the playbook |
| Grant the agent's Azure role assignments | Permission to create Azure role assignments at each target subscription scope |
Step 1: Set up the agent
Who performs this step: A Security Administrator.
- Sign in to the Microsoft Defender portal.
- Go to Perception > Agents.
- Find Web App Pen Test Agent, then select Set up.
- Follow the setup flow to create the Microsoft Entra agent identity and review the required permissions.
- Complete setup.
- Confirm that the agent is Active.
- Go to Perception > Playbooks and confirm that Run web pen test is available.
An active agent isn't sufficient to start testing. You must also add and verify the target domain.
Step 2: Define the approved testing boundary
Before adding a domain, agree with the application owner on what the assessment may access and test. Record the approved hosts, any application areas that must not be accessed, the testing window, and the test accounts.
Keep these concepts separate:
| Concept | What it establishes |
|---|---|
| Domain ownership verification | Evidence of control over a domain through DNS |
| Approved target | A configured domain available for testing after verification |
| Session inputs | The selected target, testing categories, and other instructions for a particular assessment |
Verifying contoso.com doesn't authorize or enable testing of www.contoso.com or another subdomain. Redirects and discovered links don't expand the approved boundary. Check that the exact hosts required by your application are supported and approved before running a test.
Important
Don't rely on free-text exclusions or agent instructions as enforced URL-level access controls. If an application area must not be accessed, use application-side access controls or an isolated test environment. Don't start a session if you can't keep testing within the authorized boundary.
Step 3: Add target domains
Who performs this step: A Security Administrator.
- Go to Perception > Agents > Web App Pen Test Agent.
- Open Approved targets.
- Add the domain names you intend to test. You can enter domains individually or upload a CSV file with one domain per row.
- Select Save.
- Locate the verification token generated for each domain.
New targets require ownership verification before they're available for testing.
Step 4: Verify domain ownership through DNS
Who performs this step: A DNS administrator publishes the record. A Security Administrator verifies the target in Perception.
Copy the generated verification token for the domain from Approved targets.
Ask your DNS administrator to create the following record in the DNS zone for that domain:
DNS field Value Type TXTRecord name _msft-verifyRecord value The verification token generated for this domain For example, for the zone
contoso.com, the full record name is_msft-verify.contoso.com. Some DNS providers append the zone name automatically. Check the resulting full name to avoid adding the zone twice.Allow the DNS change to become publicly resolvable.
Return to Perception > Agents > Web App Pen Test Agent > Approved targets.
Select the target showing Pending verification, then select Verify.
Confirm that verification succeeds before starting a session.
Use the token for the matching domain. Don't reuse another domain's token or substitute an application sign-in credential.
Step 5: Prepare network access and test accounts
The agent assesses the application from outside your organization's network. Domain verification doesn't make a private application reachable or bypass application authentication.
Application access
- Confirm that the approved application is reachable from the internet.
- Review redirects and sign-in dependencies. Don't assume another host becomes approved because the application links or redirects to it.
- If authenticated testing is required, prepare a least-privileged test account for a supported username-and-password sign-in flow. Don't assume that single sign-on, multifactor authentication, or an external identity provider is supported.
- Agree on how the application owner will monitor application health and respond if testing affects the application.
Optional WAF exception for assessment traffic
A Web Application Firewall (WAF) can block assessment traffic. If an exception is necessary, coordinate with the firewall administrator rather than disabling the WAF.
- Agree on a custom HTTP header name and value for the assessment. The session can generate defaults using the header name
X-MSFT-Verify. - Configure any approved exception to match that exact header name and value.
- Limit the exception to the approved application and testing period.
- Give the operator the matching name and value to enter in the session's Header input.
- Arrange for the temporary exception to end when the testing window closes.
Treat the header value as sensitive. Don't use it as an authentication credential or broaden the rule to other applications.
Step 6: Set up Protect web app (optional)
To use Protect web app, also set up the Web App Risk Reduction Agent in Perception. The playbook runs the Web App Pen Test Agent first, then uses the Web App Risk Reduction Agent to plan remediation for validated findings.
Grant Azure Reader access to the runtime identity
The Web App Risk Reduction Agent's runtime identity requires the Azure Reader role on each subscription it needs to inspect through Azure Resource Manager. Assign this role to the agent's runtime identity, not to the user running the playbook.
Who performs this step: An administrator with permission to create Azure role assignments at the target subscription scope.
- Set up the Web App Risk Reduction Agent and identify its runtime identity. For general agent setup, see Work with agents.
- Sign in to the Azure portal.
- Go to Subscriptions and select the subscription the agent needs to inspect.
- Select Access control (IAM) > Add > Add role assignment.
- On the Role tab, select Reader, then select Next.
- On the Members tab, for Assign access to, select User, group, or service principal.
- Choose Select members, find the Web App Risk Reduction Agent runtime identity, and select it. Verify that it's the intended identity.
- Select Review + assign and complete the role assignment.
- Repeat the role-assignment steps for each additional subscription the agent needs to inspect.
- Confirm that Protect web app is available in Perception > Playbooks.
Confirm permissions for WAF policy changes
Reader permits resource inspection; it doesn't grant permission to modify Azure Front Door WAF policies. Before approving or manually applying a policy change, have the Azure administrator confirm that the identity performing the change has the required write permissions on the target WAF policy. Session access and a response to a planning question don't grant those permissions or approve execution.
Keep protective WAF policy changes separate from the temporary assessment-traffic exception. Review each proposed change under your organization's authorization and change-management process.
Maintain approved targets
Use Approved targets on the agent page to review configured domains and their verification state before approving new assessments.
Recheck authorization when application ownership, hosting, redirects, or test-account permissions change. Verification and agent activation don't establish that an application remains reachable or suitable for a new test.
Keep administrative target changes separate from session instructions. An operator's request to test another host isn't a substitute for approving and verifying that host.
Troubleshoot setup and verification
| Issue | What to check |
|---|---|
| The agent or playbook isn't available | Confirm preview access, Perception setup, agent activation, and your permissions with the administrator. |
| Set up is unavailable | Ask a Security Administrator to complete agent setup. |
| DNS verification fails | Check the TXT record type, _msft-verify record name, matching token, correct DNS zone, and public DNS propagation. Check whether the provider appended the zone name twice. |
| A verified domain isn't available for a session | Confirm that you're using the intended domain and that agent setup and target verification have completed. Ask the administrator to review access and target configuration. |
| The application redirects to a different host | Review the destination with the application owner. Don't treat the redirect as authorization or assume the destination is supported. |
| The target is verified but the application can't be reached | Check public reachability, firewall rules, WAF behavior, and application availability. DNS verification proves control, not connectivity. |
| Protect web app can't inspect Azure resources | Confirm that the Web App Risk Reduction Agent is set up and that Reader is assigned to its runtime identity on the required subscription, not just to the operator. |
| A WAF policy change can't be applied | Ask the Azure administrator to check the write permissions of the identity performing the change. Reader alone isn't sufficient. |