Skip to content

Automation for ZTA #977

@sbairu

Description

@sbairu

Hi Everyone,

Could you please help me validate and test the Zero Trust Automation (ZTA) script? Your feedback would be greatly appreciated.

param (
[Parameter(Mandatory = $false)]
[string]$ReportPath = "C:\ZeroTrustAssessment"
)

================================

Zero Trust Assessment – Hybrid Worker Runbook

Requires:

- PowerShell 7

- Hybrid Runbook Worker

- Interactive sign-in available

================================

$ErrorActionPreference = "Stop"
Write-Output "Starting Zero Trust Assessment runbook..."

Ensure PowerShell 7

if ($PSVersionTable.PSVersion.Major -lt 7) {
throw "PowerShell 7 is required to run ZeroTrustAssessment."
}

Ensure module exists

if (-not (Get-Module -ListAvailable -Name ZeroTrustAssessment)) {
Write-Output "Installing ZeroTrustAssessment module..."
Install-Module ZeroTrustAssessment -Scope CurrentUser -Force -AllowClobber
}

Import-Module ZeroTrustAssessment -Force

Create report directory

if (!(Test-Path $ReportPath)) {
Write-Output "Creating report directory at $ReportPath"
New-Item -ItemType Directory -Path $ReportPath | Out-Null
}

Connect using supported method

Write-Output "Connecting to Microsoft Graph and Azure..."
Connect-ZtAssessment

Run the assessment

Write-Output "Running Zero Trust Assessment..."
Invoke-ZtAssessment -Path $ReportPath
-ShowLog `
-ExportLog

Write-Output "Zero Trust Assessment completed successfully."
Write-Output "Report location: $ReportPath"

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions