tatersecurity.com Open App

Azure Runbooks

Deploy Azure Automation runbooks for scheduled compliance scanning, endpoint vulnerability assessment, and automated remediation.

Overview

TATER uses Azure Automation Account runbooks for hands-free scheduled scanning. Four runbooks handle different workloads:

RunbookRuntimeSchedulePurpose
Scan-M365CloudPS 5.1Weekly (Sun 2 AM)M365 cloud compliance scan
Scan-EndpointsPS 5.1Daily (3 AM)MDE + Intune vulnerability scan
Run-RemediationPS 7.2On-demandPrimary remediation runbook
Run-Remediation-EXOPS 5.1On-demandExchange/Defender remediation

Prerequisites

  • Azure Subscription with Automation Account
  • Entra ID app registration with required permissions (see Registered Apps)
  • Azure Key Vault with authentication certificate
  • Managed Identity enabled on the Automation Account
  • Storage Account for remediation scripts (if using remediation)

Required PowerShell Modules

The Automation Account must have all of the following modules installed for the PS 5.1 runtime before the cloud scan will run correctly. Install in the order listed — each group depends on the one above it.

ModulePurposeNote
Az.AccountsAzure authenticationInstall first — others depend on it
Az.StorageDownload control scripts from blob storage
Az.KeyVaultRetrieve certificate from Key Vault
Az.AutomationParent→child runbook delegationRequired for remediation
Microsoft.Graph.AuthenticationGraph API authInstall before other Graph modules
Microsoft.Graph.* (6 sub-modules)Users, Groups, Reports, Applications, DirectoryManagement, SignIns
ExchangeOnlineManagementExchange Online + Security & Compliance~80 controls depend on this
MicrosoftTeamsTeams policy queriesTeams Cs* cmdlets require delegated auth — ~36 controls skip
PnP.PowerShellSharePoint Online (modern module)
Microsoft.Online.SharePoint.PowerShellSharePoint Online (legacy Get-SPOTenant cmdlets)Required for SPO_001–SPO_015 controls
Module installs are asynchronous

Each module takes 5–10 minutes to install. Install Az.Accounts first and wait for it to show Succeeded before proceeding. See AZURE_RUNBOOK_GUIDE.md §3.3 for the automated install script.

Automation Variables

Configure these variables in your Automation Account:

VariablePurpose
AppClientIdApp registration client ID
KeyVaultNameKey Vault name for certificate
CertNameCertificate name in Key Vault
TenantDomainTenant domain (e.g., contoso.onmicrosoft.com)
TenantIdAzure AD tenant ID
ApiBaseUrlTATER API base URL
ApiKeyAPI key for scan upload authentication
OrganizationIdTATER organization ID

Managed Identity Permissions

Azure RBAC

  • Automation Operator: Required for Start-AzAutomationRunbook (parent/child delegation)
  • Storage Blob Data Reader: Required for remediation script downloads

Microsoft Graph Permissions

Same permissions as the app registration. See Graph API Permissions.

Cloud Scan Runbook

The Scan-M365Cloud runbook authenticates to M365 services using the certificate from Key Vault, evaluates control scripts against your tenant, and uploads results to the TATER API.

Import order matters

Import Graph sub-modules BEFORE connecting Exchange Online. If EXO is connected first, its assembly bindings may conflict with Graph modules.

Endpoint Scan Runbook

The Scan-Endpoints runbook queries MDE API and Intune for device inventory, vulnerabilities, software, and CISA KEV data. Key technical details:

  • Uses Invoke-RestMethod directly (not Invoke-MgGraphRequest which is unavailable in PS 5.1 sandbox)
  • MDE API requires a separate OAuth token with api.securitycenter.microsoft.com scope
  • Queries vulnerabilities per-machine (not bulk) to avoid memory limits (~400MB sandbox)
  • Deduplicates CVEs across all devices

Remediation Runbooks

Two-runbook architecture for automated remediation:

Run-Remediation (PS 7.2)

  • Receives webhook trigger from TATER API
  • Downloads remediation script from blob storage
  • Scans script for Exchange Online cmdlets
  • If EXO cmdlets found, delegates to PS 5.1 companion
  • Otherwise executes script directly with Graph API token
  • Reports status back to TATER API

Run-Remediation-EXO (PS 5.1)

  • Called by parent runbook via Start-AzAutomationRunbook
  • Connects to Exchange Online using certificate auth
  • Executes Exchange/Defender/Security & Compliance remediation scripts
  • Returns results to parent for API status update
PS 7.2 limitation

The ExchangeOnlineManagement module is not compatible with PS 7.2 hosted runtime. Exchange cmdlets must run in the PS 5.1 companion runbook.

Schedules

Schedule NameFrequencyTime (ET)Runbook
weekly-m365-scanWeeklySunday 2:00 AMScan-M365Cloud
daily-endpoint-scanDaily3:00 AMScan-Endpoints

Troubleshooting

Teams controls show SKIP?

Teams Cs* cmdlets require delegated authentication and cannot be automated in runbooks. Approximately 36 Teams controls permanently return SKIP status. This is a known limitation.

Start-AzAutomationRunbook fails?

The Automation Account's Managed Identity needs the Automation Operator role on itself for parent-to-child runbook delegation.

MDE bulk vulnerabilities OOM?

The tenant-wide MDE vulnerabilities endpoint can cause out-of-memory in the ~400MB sandbox. The Scan-Endpoints runbook uses per-machine queries with deduplication instead.

Runbook not updating after publish?

The az automation runbook replace-content CLI sometimes caches old content. Use the Azure REST API directly for reliable PS 7.2 runbook updates.