Skip to content

Command Reference

AzureLocalRanger exports twelve public commands:

  • Invoke-AzureLocalRanger — main entry point (pass -Wizard for the guided first-run)
  • Invoke-RangerWizard — standalone wrapper around the wizard, equivalent to -Wizard
  • New-AzureLocalRangerConfig — generate an annotated config scaffold
  • Export-AzureLocalRangerReport — re-render reports from a saved manifest
  • Test-AzureLocalRangerPrerequisites — validate the execution environment
  • Test-RangerPermissions — pre-run RBAC / provider-registration audit
  • Export-RangerWafConfig / Import-RangerWafConfig — v2.0.0 WAF rule config hot-swap
  • Get-RangerRemediation — v2.2.0 emit a copy-pasteable remediation script or runbook from a manifest
  • Publish-RangerRun — v2.3.0 push a run package to Azure Blob and stream telemetry to Log Analytics
  • Invoke-AzureLocalRangerEstate — v2.5.0 run Ranger across a multi-cluster estate config
  • Import-RangerManualEvidence — v2.5.0 merge hand-collected evidence into an existing manifest

Input Resolution Precedence

text
Parameter  ->  Config file  ->  Arc auto-discovery  ->  Interactive prompt  ->  Default  ->  Error

In interactive sessions, two prompts fire automatically when their values are not already resolved:

  • Cluster selection — when only tenantId + subscriptionId are supplied, Select-RangerCluster enumerates HCI clusters and auto-selects a singleton; multiples show a numbered menu.
  • Run mode — when -OutputMode is not on the CLI, a short menu asks whether this is a current-state or as-built run before the run starts. The prompt defaults to whatever output.mode is in the config (or current-state if unset). Omit -OutputMode as-built on the CLI to always be prompted; set it in the config file or pass it as a parameter to skip the prompt.

Invoke-AzureLocalRanger

ParameterTypeRequiredDescription
-ConfigPathstringOne of ConfigPath / ConfigObjectPath to a YAML or JSON config file
-ConfigObjecthashtable / objectOne of ConfigPath / ConfigObjectIn-memory config for automation or testing
-OutputPathstringNoOverride output.rootPath
-IncludeDomainstring[]NoRestrict to named data domains; not an AD domain filter
-ExcludeDomainstring[]NoExclude named data domains from an otherwise full run
-ClusterCredentialPSCredentialNoOverride credentials.cluster
-DomainCredentialPSCredentialNoOverride credentials.domain
-BmcCredentialPSCredentialNoOverride credentials.bmc
-NoRenderswitchNoCollect only and skip report generation
-UnattendedswitchNoDisable interactive prompts and return a non-zero process exit when collectors fail
-BaselineManifestPathstringNoCompare the new run with a previous audit-manifest.json and emit drift-report.json
-ClusterFqdnstringNoOverride targets.cluster.fqdn
-ClusterNodesstring[]NoOverride targets.cluster.nodes
-EnvironmentNamestringNoOverride environment.name
-SubscriptionIdstringNoOverride targets.azure.subscriptionId
-TenantIdstringNoOverride targets.azure.tenantId
-ResourceGroupstringNoOverride targets.azure.resourceGroup
-ShowProgressswitchNoShow live per-collector progress bars (requires PwshSpectreConsole; suppressed in CI and -Unattended)
-OutputModestringNocurrent-state or as-built. Overrides output.mode
-OutputFormatsstring[]NoFormats to render: html, markdown, docx, xlsx, pdf, svg, drawio, powerbi (#210), json-evidence (#229). Overrides output.formats
-TransportstringNoauto, winrm, or arc. Overrides behavior.transport
-DegradationModestringNograceful or strict. Overrides behavior.degradationMode
-RetryCountintNoWinRM retry attempts. Overrides behavior.retryCount
-TimeoutSecondsintNoWinRM operation timeout in seconds. Overrides behavior.timeoutSeconds
-AzureMethodstringNoAzure auth method: existing-context, managed-identity, device-code, service-principal, service-principal-cert, azure-cli. Overrides credentials.azure.method
-ClusterNamestringNoDisplay name used in reports. Overrides environment.clusterName
-WizardswitchNov1.6.0 (#211). Dispatch to the interactive wizard (same as Invoke-RangerWizard)
-OutputConfigPathstringNoWith -Wizard: pre-fill the save path for the generated config
-SkipRunswitchNoWith -Wizard: save only, do not launch a run
-SkipPreCheckswitchNov1.6.0 (#212). Skip the pre-run RBAC / provider audit
-SkipModuleUpdateswitchNov2.0.0 (#231). Skip the required-module install/update validation on startup (air-gapped environments)
-PublishToStorageswitchNov2.3.0 (#244). Push the run package to Azure Blob after the run completes. Requires output.remoteStorage config block
-PublishToLogAnalyticsswitchNov2.3.0 (#247). Stream RangerRun_CL + RangerFinding_CL rows to Log Analytics after the run. Requires output.logAnalytics config block
-NetworkDeviceConfigsstring[]Nov2.6.5 (#314). Path(s) to switch or firewall running-config export files. Directories are recursively expanded to .txt, .cfg, .conf, .log files. Populates domains.hints.networkDeviceConfigs

Since v1.6.0 (#211) the interactive wizard is reachable as an inline switch on the main command. This is the recommended first-run path.

ParameterTypeRequiredDescription
-WizardswitchYesDispatch to the interactive wizard
-OutputConfigPathstringNoPre-fill the save path for the generated config file
-SkipRunswitchNoSave the config but skip launching a run regardless of wizard choice

The wizard walks through:

  1. Environment name and cluster display name
  2. Cluster FQDN and node FQDNs (leave blank to auto-discover from Arc)
  3. Azure subscription ID, tenant ID, and resource group (GUIDs validated inline)
  4. Credential strategy — one of six: existing-context, runtime prompt, service-principal, managed-identity, device-code, azure-cli
  5. BMC / iDRAC — optional endpoint IPs for hardware and OEM collection
  6. Output — run mode (current-state or as-built), root path, report formats
  7. Scope — include or exclude specific data domains

At the end it prints a full review screen with the resulting YAML config. Press Enter to continue, or type N to cancel without saving. Then it offers: [S] save only, [R] run immediately without saving, or [B] save and run.

powershell
# Launch the wizard
Invoke-AzureLocalRanger -Wizard

# Pre-fill the save path
Invoke-AzureLocalRanger -Wizard -OutputConfigPath C:\ranger\tplabs.yml

# Save only, no run
Invoke-AzureLocalRanger -Wizard -SkipRun

Invoke-RangerWizard (standalone; equivalent to -Wizard)

Kept exported for scripts that already depend on it. Identical behaviour to Invoke-AzureLocalRanger -Wizard — accepts the same -OutputConfigPath and -SkipRun parameters. New code should prefer the -Wizard switch so every entry into Ranger starts from the same command.

Requires an interactive host — throws InvalidOperationException in non-interactive sessions.

Scheduled Runs

Use -Unattended for Task Scheduler, GitHub Actions, and other non-interactive runners.

Recommended pattern:

  • store Azure secrets in Key Vault and reference them through keyvault://<vault>/<secret>
  • use a service principal, managed identity, or existing Az context for Azure authentication
  • keep cluster, domain, and BMC credentials pre-resolved in config or injected by the scheduler
  • set -OutputPath to a central share or artifact folder when multiple runs must be retained

Example:

powershell
Invoke-AzureLocalRanger `
  -ConfigPath .\ranger.yml `
  -Unattended `
  -OutputPath \\fileserver\AzureLocalRanger `
  -BaselineManifestPath .\baseline\audit-manifest.json

Ranger writes run-status.json for scheduler monitoring and manifest\drift-report.json when a baseline manifest is supplied. Sample scheduler templates live under samples/.

Data Domain Names

Canonical nameAliasesWhat it collects
clustertopology, clusterCluster identity, nodes, quorum, CAU, Arc cluster posture
storage-networkingstorage, networkingPools, disks, volumes, cluster networks, adapters, RDMA, ATC
identity-securityidentity, securityIdentity, certificates, BitLocker, WDAC, Defender, RBAC
azure-integrationazureArc, policy, monitoring, updates, backup, ASR, and resource-bridge overlays
hardwarehardware, oemRedfish hardware, firmware, disks, memory, GPUs, and BMC posture
management-performancemanagement, performanceWAC, agents, performance counters, and event or management signals

New-AzureLocalRangerConfig

ParameterTypeRequiredDescription
-PathstringYesOutput path for the generated config
-FormatstringNoyaml or json; default is yaml
-ForceswitchNoOverwrite an existing file

Export-AzureLocalRangerReport

ParameterTypeRequiredDescription
-ManifestPathstringYesPath to an existing audit-manifest.json
-OutputPathstringNoDestination folder; defaults to the manifest folder
-Formatsstring[]NoAny of html, markdown, docx, xlsx, pdf, svg, drawio, pptx, powerbi, json-evidence

Get-RangerRemediation

v2.2.0 (#243). Reads an existing manifest, evaluates WAF rules, and emits a copy-pasteable remediation script or markdown runbook. Does not require cluster or Azure connectivity — operates entirely from the saved manifest.

ParameterTypeRequiredDescription
-ManifestPathstringYesPath to an existing audit-manifest.json
-FindingIdstring[]NoOne or more WAF rule IDs to include; omit for all failing rules
-OutputPathstringNoDestination file; defaults to ranger-remediation-<timestamp>.<ext> in the current directory
-FormatstringNops1 (default), md, or checklist
-CommitswitchNoEmit live cmdlets instead of dry-run previews
-IncludeDependenciesswitchNoExpand prerequisite rules ahead of their dependents
powershell
# Markdown runbook for all failing rules
Get-RangerRemediation -ManifestPath .\audit-manifest.json -Format md

# Dry-run PowerShell script for a specific rule
Get-RangerRemediation -ManifestPath .\audit-manifest.json -FindingId SEC-001,OPS-003

# Live script with dependency expansion
Get-RangerRemediation -ManifestPath .\audit-manifest.json -Commit -IncludeDependencies

Publish-RangerRun

v2.3.0 (#244). Push an already-written Ranger run package to Azure Blob Storage and update the per-cluster catalog and account-level index blob. Optionally streams RangerRun_CL and RangerFinding_CL telemetry to a Log Analytics Workspace via DCE/DCR. See Cloud Publishing for full setup.

ParameterTypeRequiredDescription
-PackagePathstringYesRoot folder of the Ranger run package to publish
-StorageAccountstringYesAzure Storage account name
-ContainerstringNoBlob container name; default ranger-runs
-LogAnalyticsWorkspaceIdstringNoWorkspace ID for Log Analytics telemetry
-DcrImmutableIdstringNoDCR immutable ID for Log Analytics ingestion
-DceEndpointstringNoData Collection Endpoint URL
-OfflineswitchNoSkip upload; validate and report only
powershell
# Publish the most recent run
Publish-RangerRun -PackagePath C:\AzureLocalRanger\tplabs-current-state-20260417T044502Z -StorageAccount saranger01

Invoke-AzureLocalRangerEstate

v2.5.0 (#129). Run Ranger across every cluster in an estate config file and emit a cross-cluster rollup. Outputs estate-rollup.json, estate-summary.html, and powerbi/estate-clusters.csv to the configured root path.

ParameterTypeRequiredDescription
-ConfigPathstringOne of ConfigPath / ConfigObjectPath to an estate config YAML or JSON file
-ConfigObjecthashtableOne of ConfigPath / ConfigObjectIn-memory estate config
-OutputPathstringNoOverride output.rootPath from the estate config
-ClusterCredentialPSCredentialNoShared cluster WinRM credential applied to all clusters
-DomainCredentialPSCredentialNoShared domain credential
-UnattendedswitchNoSuppress interactive prompts
powershell
# Run estate rollup
Invoke-AzureLocalRangerEstate -ConfigPath C:\ranger\estate.yml

# Unattended with shared credential
$cred = Get-Credential
Invoke-AzureLocalRangerEstate -ConfigPath C:\ranger\estate.yml -ClusterCredential $cred -Unattended

Estate config structure:

yaml
estate:
  name: contoso-production
  clusters:
    - name: tplabs-clus01
      configPath: C:\ranger\tplabs-clus01.yml
    - name: tplabs-clus02
      configPath: C:\ranger\tplabs-clus02.yml
output:
  rootPath: C:\AzureLocalRanger\estate

Import-RangerManualEvidence

v2.5.0 (#32). Merge hand-collected evidence — network device configs, firewall exports, paper inventories — into an existing audit-manifest.json with provenance labels. The evidence is recorded under manifest.domains.<domain>.manualImport and tracked in manifest.run.manualImports.

ParameterTypeRequiredDescription
-ManifestPathstringYesPath to an existing audit-manifest.json to enrich
-EvidencePathstringYesPath to a JSON file with domain (string) and data (object/array) keys
-SourcestringYesLabel describing the data origin (e.g. manual-network-inventory)
-OutputPathstringNoOptional alternate output path; defaults to overwriting the source manifest

Evidence file format:

json
{
  "domain": "networkDeviceEvidence",
  "provenance": { "collectedBy": "ops-team", "collectedAt": "2026-04-17T00:00:00Z" },
  "data": {
    "switches": [ { "name": "tor-sw-01", "model": "Dell S5248F-ON" } ],
    "firewalls": [ { "name": "fw-edge-01", "platform": "FortiGate" } ]
  }
}
powershell
Import-RangerManualEvidence `
  -ManifestPath .\audit-manifest.json `
  -EvidencePath .\network-inventory.json `
  -Source 'manual-network-inventory'

Test-AzureLocalRangerPrerequisites

ParameterTypeRequiredDescription
-ConfigPathstringNoValidate a config file as part of the check
-ConfigObjecthashtable / objectNoValidate an in-memory config
-InstallPrerequisitesswitchNoInstall missing prerequisites in an elevated session
-ClusterFqdnstringNoStructural override for validation
-ClusterNodesstring[]NoStructural override for validation
-EnvironmentNamestringNoStructural override for validation
-SubscriptionIdstringNoStructural override for validation
-TenantIdstringNoStructural override for validation
-ResourceGroupstringNoStructural override for validation

Common Scenarios

Complete, copy-paste examples for the most frequent use cases.

One-off run — no config file

powershell
Invoke-AzureLocalRanger `
  -ClusterFqdn tplabs-clus01.contoso.com `
  -SubscriptionId 00000000-0000-0000-0000-000000000000 `
  -TenantId 11111111-1111-1111-1111-111111111111 `
  -ResourceGroup rg-azlocal-prod-01 `
  -EnvironmentName tplabs-prod-01

Run from a saved config file

powershell
Invoke-AzureLocalRanger -ConfigPath C:\ranger\tplabs.yml

Override a single config value at runtime

powershell
Invoke-AzureLocalRanger -ConfigPath C:\ranger\tplabs.yml -OutputPath D:\ranger-archive

Collect specific domains only (focused run)

powershell
Invoke-AzureLocalRanger -ConfigPath C:\ranger\tplabs.yml `
  -IncludeDomain cluster,storage-networking,azure-integration

Skip specific domains (broad run minus slow collectors)

powershell
Invoke-AzureLocalRanger -ConfigPath C:\ranger\tplabs.yml `
  -ExcludeDomain hardware,management-performance

Unattended / scheduled run with drift detection

powershell
Invoke-AzureLocalRanger `
  -ConfigPath C:\ranger\tplabs.yml `
  -Unattended `
  -OutputPath \\fileserver\AzureLocalRanger `
  -BaselineManifestPath C:\ranger\baseline\audit-manifest.json

Collect only — skip report rendering

powershell
Invoke-AzureLocalRanger -ConfigPath C:\ranger\tplabs.yml -NoRender

Useful when you want to inspect the raw manifest before rendering or when rendering will be done later.

Re-render reports from an existing manifest

powershell
Export-AzureLocalRangerReport `
  -ManifestPath C:\AzureLocalRanger\tplabs-current-state-20260416T044502Z\manifest\audit-manifest.json `
  -Formats html,docx,xlsx,pdf,svg

No cluster or Azure connectivity required — renders entirely from the saved manifest.

Check prerequisites before running

powershell
# Check only
Test-AzureLocalRangerPrerequisites

# Check and auto-install missing modules (elevated session required)
Test-AzureLocalRangerPrerequisites -InstallPrerequisites

Generate a new config scaffold

powershell
New-AzureLocalRangerConfig -Path C:\ranger\new-cluster.yml

Opens YAML with inline comments and [REQUIRED] markers on mandatory fields.

Pass explicit credentials at runtime

powershell
$clusterCred = Get-Credential -Message "Cluster WinRM credential"
$bmcCred     = Get-Credential -Message "iDRAC credential"

Invoke-AzureLocalRanger `
  -ConfigPath C:\ranger\tplabs.yml `
  -ClusterCredential $clusterCred `
  -BmcCredential $bmcCred

Parameter Precedence

When the same value can come from multiple sources, Ranger resolves in this order — first match wins:

text
Runtime parameter  →  Config file value  →  Interactive prompt  →  Built-in default  →  Error

Example: if your config file sets output.rootPath: C:\AzureLocalRanger but you pass -OutputPath D:\archive, Ranger writes to D:\archive for that run without touching the config file.

This applies to all structural values: environment name, cluster addressing, Azure target metadata, output path, and domain filters. Credentials follow the same shape but can also resolve through passwordRef URIs evaluated after the config file step.


Released under the MIT License.