Automation Consulting. Unabhängig vom Frontend.

Azure Automation accounts often start as a convenience. Someone needs to schedule a script. They create an Automation Account, add a runbook, and it works. Six months later, that account runs 30 production runbooks with broad permissions, shared credentials, and no audit trail.
We’ve audited Automation environments where a single account had Contributor access to the entire subscription. Where credentials were stored as unencrypted variables. Where anyone in the IT team could edit runbooks directly in the portal.
None of this started as negligence. It started as “we’ll secure it later.” Later never came.
This guide covers the architecture decisions that make an Azure Automation environment secure from the start. Not theoretical best practices. Concrete configurations we implement in consulting projects.
Run As Accounts are deprecated. Certificate-based service principals are complex to maintain. Application secrets expire and rotate awkwardly. Managed Identity eliminates all of these problems.
Every Automation Account should have a System-assigned Managed Identity enabled. It’s a single toggle in the Azure Portal. Once enabled, the Automation Account gets an identity in Entra ID that can be granted RBAC roles.
In your runbooks, authentication becomes one line:
Connect-AzAccount -Identity
No certificates. No secrets. No rotation. The identity is tied to the lifecycle of the Automation Account. Delete the account, the identity disappears.
For scenarios where multiple Automation Accounts need identical permissions, or where you need the identity to persist independently of the account, use a User-assigned Managed Identity.
Create the identity once. Assign it RBAC roles. Attach it to multiple Automation Accounts. If you rebuild an Automation Account, reattach the same identity without re-granting permissions.
In runbooks, specify which identity to use:
Connect-AzAccount -Identity -AccountId "client-id-of-user-assigned-identity"
Sometimes Managed Identity isn’t enough. Cross-tenant access, third-party APIs that require OAuth client credentials, or legacy applications that only support certificate auth. In these cases, store credentials in Azure Key Vault and retrieve them at runtime. Never as Automation variables. Never in runbook code.
See the most common Azure Automation mistakes including credential handling
The most dangerous Automation Account is one with Contributor access to the subscription. It can create resources, modify configurations, delete entire resource groups. If a runbook is compromised, the blast radius is everything.
Start with zero permissions. For each runbook, document exactly what it needs to do. Then grant the minimum RBAC role at the narrowest scope.
Examples:
| Runbook Purpose | RBAC Role | Scope |
|---|---|---|
| Start/Stop VMs | Virtual Machine Contributor | Resource Group containing the VMs |
| Read Log Analytics | Log Analytics Reader | Specific workspace |
| Manage DNS records | DNS Zone Contributor | Specific DNS zone |
| Create Entra ID users | User Administrator | Directory level |
| Send email via Graph | Mail.Send | Specific mailbox |
Custom roles work well for Automation. If a runbook only needs to start and stop VMs (not delete or resize), create a custom role with just Microsoft.Compute/virtualMachines/start/action and Microsoft.Compute/virtualMachines/deallocate/action. Nothing more.
Review permissions quarterly. Runbooks get decommissioned, but their permissions linger. We’ve found Automation Accounts with roles for resources that no longer exist.
Who can do what with the Automation Account matters as much as what the account can do to other resources.
Azure provides three relevant built-in roles:
Automation Operator: Can start jobs and view runbooks but not edit them. Perfect for operations teams who need to trigger runbooks without modifying code.
Automation Contributor: Can create and edit runbooks, manage schedules, and configure the account. For the automation development team.
Reader: Can view everything but change nothing. For auditors, managers, or anyone who needs visibility without control.
Don’t give everyone Contributor access. In most organizations, 2–3 people need Contributor. Everyone else should be an Operator or Reader.
For sensitive runbooks (those handling user provisioning, financial data, or security operations), consider a dedicated Automation Account with tighter RBAC. Separation of duties isn’t just for compliance. It limits the damage if someone makes a mistake.
Azure Automation has built-in credential assets and encrypted variables. They work. But Key Vault is better.
Why Key Vault over Automation credentials:
Implementation pattern:
# Connect with Managed Identity
Connect-AzAccount -Identity
# Retrieve secrets from Key Vault
$apiKey = Get-AzKeyVaultSecret -VaultName "automation-secrets" -Name "ServiceNow-APIKey" -AsPlainText
$dbPassword = Get-AzKeyVaultSecret -VaultName "automation-secrets" -Name "SQL-Password" -AsPlainText
# Use secrets in runbook logic
$headers = @{ "Authorization" = "Bearer $apiKey" }
Grant the Automation Account’s Managed Identity the “Key Vault Secrets User” role on the Key Vault. Not “Key Vault Administrator.” Not “Key Vault Contributor.” Just “Secrets User” for read-only access to secrets.
Hybrid Runbook Workers run inside your network. That makes them powerful and a potential attack vector.
Network isolation:
OS hardening:
Monitoring:
For environments where no traffic should traverse the public internet, Azure Automation supports Private Endpoints. This means:
Setup requires a Private DNS Zone (privatelink.azure-automation.net) and a Private Endpoint in your VNet. The Azure Portal walks you through it, or use Terraform/Bicep for repeatability.
Private Endpoints add complexity. Not every environment needs them. But for regulated industries (finance, healthcare, government) or environments handling sensitive data, they’re the right call.
Runbooks are code. Code belongs in source control. Full stop.
Azure Automation integrates natively with GitHub and Azure DevOps. Once connected, runbooks sync automatically from your repository. No more editing in the portal.
Benefits beyond version history:
For organizations with strict change management, this workflow maps directly to ITIL change processes. The pull request is the change request. The review is the approval. The merge is the implementation. The git log is the audit trail.
Common runbook errors that source control helps prevent
A secure environment is a monitored environment. If a runbook fails at 3 AM and nobody knows until 9 AM, that’s six hours of potential impact.
Configure Azure Monitor alerts for:
Send Automation job logs to a Log Analytics workspace. This enables:
Sample KQL query to find runbooks with increasing failure rates:
AzureDiagnostics
| where ResourceProvider == "MICROSOFT.AUTOMATION"
| where Category == "JobLogs"
| where ResultType == "Failed"
| summarize FailureCount = count() by RunbookName_s, bin(TimeGenerated, 1d)
| order by TimeGenerated desc
Beyond operational monitoring, watch for security-relevant events:
Feed these into Microsoft Sentinel or your SIEM for correlation with broader security events.
Azure Automation encrypts credential assets by default. Variables can be encrypted optionally. Always enable encryption for variables that contain sensitive data.
But understand the limitation: encrypted variables are decrypted at runtime inside the runbook. If the runbook logs the value (accidentally or intentionally), the encryption doesn’t help. Code review and output monitoring matter.
All communication between Azure Automation and its components uses TLS 1.2+. This includes:
For runbooks that call external APIs, verify TLS configuration:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
This is the default in PowerShell 7.x but may need to be set explicitly in 5.1 environments.
Here’s the complete secure architecture we recommend:
┌─────────────────────────────────────────────────â”
│ Azure Subscription │
│ │
│ ┌──────────────────┠┌──────────────────┠│
│ │ Automation Account│───▶│ Key Vault │ │
│ │ (Managed Identity)│ │ (Secrets, Keys) │ │
│ │ Source Control: │ └──────────────────┘ │
│ │ GitHub/DevOps │ │
│ └────────┬─────────┘ ┌──────────────────┠│
│ │ │ Log Analytics │ │
│ │ │ (Job Logs, Diag) │ │
│ ▼ └──────────────────┘ │
│ ┌──────────────────┠│
│ │ Hybrid Worker │ ┌──────────────────┠│
│ │ (Dedicated Subnet│───▶│ Azure Monitor │ │
│ │ NSG, No PubIP) │ │ (Alerts) │ │
│ └──────────────────┘ └──────────────────┘ │
│ │
└─────────────────────────────────────────────────┘
Each component has a single responsibility. RBAC is scoped narrowly. Secrets live in Key Vault. Changes go through source control. Failures trigger alerts. Every action is logged.
This isn’t overengineering. It’s the baseline for any Automation Account running production workloads.
System-assigned is simpler for single-account setups. The identity lives and dies with the Automation Account. User-assigned is better when multiple accounts need the same permissions or when you need the identity to survive account rebuilds. Most organizations start with System-assigned and add User-assigned for specific cross-account scenarios.
With Source Control integration, every change is a git commit with author, timestamp, and diff. Without it, Azure Activity Log captures who modified the Automation Account resources, but with less detail. Source Control is the reliable audit path.
Not natively at the individual runbook level. RBAC applies to the Automation Account as a whole. To restrict execution of specific runbooks, use separate Automation Accounts with different RBAC assignments. Some organizations create a “sensitive operations” account with tight access and a “general operations” account with broader access.
Private Endpoints themselves have a small hourly cost (around .30/month per endpoint). The bigger cost is DNS management complexity and the requirement that Hybrid Workers resolve the private DNS zone. For regulated environments, this cost is trivial compared to the compliance benefit.
Quarterly at minimum. Include it in your regular access review cycle. Check: Does the Managed Identity still need all its roles? Are there roles for resources that no longer exist? Has anyone been granted Contributor access who should be an Operator?
Need help securing your Azure Automation environment? We design and implement secure Automation architectures for organizations across Europe. From initial assessment to full implementation, we bring real-world experience to every project.