Clone – Azure Automation Connections (Runbooks)
Im Folgenden findest du ein PowerShell-Skript, mit dem du Azure Automation Connections auf einen anderen Azure Automation Account kopieren kannst.
<#
Clone Azure Automation Connections to another Account
#>
## Source Automation Account
$ResourceGroup1 = "name"
$AutomationAccount1 = "name"
## Destination Automation Account
$ResourceGroup2 = "name"
$AutomationAccount2 = "name"
## Connect to Azure AD by Managed Identity
Connect-AzAccount
$Connects = Get-AzAutomationConnection -ResourceGroupName $ResourceGroup1 -AutomationAccountName $AutomationAccount1
$Connects | ForEach-Object {
$Conn = Get-AzAutomationConnection -ResourceGroupName $ResourceGroup1 -AutomationAccountName $AutomationAccount1 -Name $_.Name
$RunAsAccountConnectionFieldValues = @{"SubscriptionId" = $Conn.FieldDefinitionValues.SubscriptionId; "TenantId" = $Conn.FieldDefinitionValues.TenantId; "ApplicationId" = $Conn.FieldDefinitionValues.ApplicationId; "CertificateThumbprint" = $Conn.FieldDefinitionValues.CertificateThumbprint}
#Clone Connections to Azure Automation Account
New-AzAutomationConnection -Name $_.Name -ConnectionTypeName AzureServicePrincipal -ConnectionFieldValues $RunAsAccountConnectionFieldValues -ResourceGroupName $ResourceGroup2 -AutomationAccountName $AutomationAccount2
}
DisConnect-AzAccount
Wie kann man Azure Automation Connections ein Backup & Restore erstellen? Schau dir den letzten Posts an.