Microsoft PSRP Provider for Apache Airflow
raw JSON → 3.2.5 verified Fri May 01 auth: no python
Apache Airflow provider for Microsoft PowerShell Remoting Protocol (PSRP), enabling remote execution of PowerShell commands and scripts on Windows hosts. Current version 3.2.5, part of the official Airflow providers collection. Releases follow Airflow's provider release cadence.
pip install apache-airflow-providers-microsoft-psrp Common errors
error ModuleNotFoundError: No module named 'airflow.providers.microsoft' ↓
cause The provider package is not installed or Airflow providers namespace is missing.
fix
Run 'pip install apache-airflow-providers-microsoft-psrp' and ensure Airflow is installed (version 2.1+).
error pypsrp.exceptions.WinRMTransportError: ('http', 'Connection refused') ↓
cause WinRM service not running or port blocked on target Windows host.
fix
Verify WinRM is enabled: run 'Enable-PSRemoting -Force' on the Windows host and check firewall rules for port 5985 (HTTP) or 5986 (HTTPS).
error pypsrp.exceptions.AuthenticationError: Authentication failed, check credentials ↓
cause Incorrect username/password, or authentication protocol mismatch between client and server.
fix
Double-check the Airflow connection credentials. Ensure the authentication type (NTLM, Kerberos, Basic) matches the server configuration. For NTLM, use DOMAIN\username format.
Warnings
breaking Provider package was renamed from 'airflow-provider-microsoft-psrp' to 'apache-airflow-providers-microsoft-psrp' around Airflow 2.0. Old import paths are deprecated. ↓
fix Use the correct install command: pip install apache-airflow-providers-microsoft-psrp and import from airflow.providers.microsoft.psrp.
gotcha The PSRP operator communicates over WinRM (port 5985/5986). Ensure the target Windows host has WinRM enabled and configured for PSRP. Firewall rules must allow the port. ↓
fix On Windows, run: Enable-PSRemoting -Force. Adjust firewall rules to allow WinRM traffic.
gotcha Authentication methods (NTLM, Kerberos, Basic) require careful setup. Kerberos needs appropriate SPN and DNS configuration; Basic requires SSL. ↓
fix For testing, use NTLM with a local admin account. For production, prefer Kerberos or SSL with Basic.
deprecated Some older connection parameters (like 'port') may not be supported in newer provider versions. Always use the connection UI fields as documented. ↓
fix Recreate connections using the Airflow UI for the PSRP provider; avoid manual extras in connection string.
Imports
- PsrpOperator
from airflow.providers.microsoft.psrp.operators.psrp import PsrpOperator - PsrpHook
from airflow.providers.microsoft.psrp.hooks.psrp import PsrpHook
Quickstart
from datetime import datetime
from airflow import DAG
from airflow.providers.microsoft.psrp.operators.psrp import PsrpOperator
dag = DAG(
'example_psrp',
start_date=datetime(2025, 1, 1),
schedule_interval=None,
catchup=False
)
run_powershell = PsrpOperator(
task_id='run_command',
conn_id='psrp_default', # must be configured in Airflow connections
command='Get-Process | Format-Table -AutoSize',
dag=dag
)