Skip to content
3.0 preview2.3.0 stable

These docs describe the preview. Pick the version you run and every page marks what it doesn't have yet. Get the preview →
Maester 2.x docs (archived) →

Sponsor

(Tenant) Restrict Personal Access Token lifespan

AZDO.1035HighAzure DevOpsSecurity policiesPreview 3.0

Part of Maester · Azure DevOps · Security policies · All checks

Run this check
Invoke-Maester -TestId AZDO.1035

Restrict setting a maximum Personal Access Token (PAT) lifespan should be enabled.

  • Your organization must be linked to a Microsoft Entra tenant.
  • You must be an Azure DevOps Administrator to configure tenant policies.

Restricting PAT lifespan by enforcing a maximum expiration reduces the risk of long-lived credentials being reused after compromise, helps meet compliance requirements, and encourages regular credential rotation.

Enable the tenant policy to enforce a maximum PAT lifespan.

  1. Sign in to your organization (https://dev.azure.com/{yourorganization}).
  2. Select Organization settings (gear icon).
  3. Select Microsoft Entra, find the “Enforce maximum personal access token lifespan” policy.
  4. Move the toggle to On.
  5. Enter the maximum number of days and select Save.
  • Each tenant policy has its own allowlist; add Microsoft Entra users or groups to exempt them from the restriction.
  • Use groups for allowlists; adding named users can create identity residency concerns.

Existing PATs:

Existing PATs remain valid until their configured expiration date and are not retroactively shortened by this setting.

Results:

When enabled, newly created or renewed PATs will have a maximum lifespan (in days) and will automatically expire after that period.

Every attribute of this check
FieldValue
Test IDAZDO.1035
SeverityHigh
SuiteMaester
ProductAzure DevOps
FeatureSecurity policies
AreaAuthentication
Resource typeTenant
User impactMedium
Implementation costLow
MITRE ATT&CKT1528 Steal Application Access Token, T1550.001 Application Access Token
Supports controlsnist-800-53-r5:IA-5
PowerShell testTest-AzdoRestrictPersonalAccessTokenLifespan
ServicesAzureDevOps
Learn morehttps://learn.microsoft.com/azure/devops/organizations/accounts/manage-pats-with-policies-for-administrators?view=azure-devops#restrict-personal-access-token-lifespan