New-AzAutomationConnection

Creates an Automation connection.

Syntax

New-AzAutomationConnection
   [-Name] <String>
   [-ConnectionTypeName] <String>
   [-ConnectionFieldValues] <IDictionary>
   [-Description <String>]
   [-ResourceGroupName] <String>
   [-AutomationAccountName] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The New-AzAutomationConnection cmdlet creates a connection in Azure Automation.

Examples

Example 1: Create a connection for ConnectionTypeName=Azure

PS C:\> $FieldValues = @{"AutomationCertificateName"="ContosoCertificate";"SubscriptionID"="81b59010-dc55-45b7-89cd-5ca26db62472"}
PS C:\> New-AzAutomationConnection -Name "Connection12" -ConnectionTypeName Azure -ConnectionFieldValues $FieldValues -ResourceGroupName "ResourceGroup01" -AutomationAccountName "AutomationAccount01"

The first command assigns a hash table of field values to the $FieldValue variable. The second command creates an Azure connection named Connection12 in the Automation account named AutomationAccount01. The command uses the connection field values in $FieldValues.

Example 2: Create a connection for ConnectionTypeName=AzureServicePrincipal

PS C:\> $Thumbprint = "0SZTNJ34TCCMUJ5MJZGR8XQD3S0RVHJBA33Z8ZXV"
PS C:\> $TenantId = "4cd76576-b611-43d0-8f2b-adcb139531bf"
PS C:\> $ApplicationId = "3794a65a-e4e4-493d-ac1d-f04308d712dd"
PS C:\> $SubscriptionId = "81b59010-dc55-45b7-89cd-5ca26db62472"
PS C:\> $RunAsAccountConnectionFieldValues = @{"ApplicationId" = $ApplicationId; "TenantId" = $TenantId; "CertificateThumbprint" = $Thumbprint; "SubscriptionId" = $SubscriptionId}
PS C:\> New-AzAutomationConnection -Name "Connection13" -ConnectionTypeName AzureServicePrincipal -ConnectionFieldValues $RunAsAccountConnectionFieldValues -ResourceGroupName "ResourceGroup01" -AutomationAccountName "AutomationAccount01"

The command creates an Azure connection named Connection13 in the Automation account named AutomationAccount01 using $RunAsAccountConnectionFieldValues and ConnectionTypeName=AzureServicePrincipal. This ConnectionTypeName=AzureServicePrincipal is mainly used for Azure Run As Account.

Example 3: Create a connection for ConnectionTypeName=AzureClassicCertificate

PS C:\> $SubscriptionName = "MyTestSubscription"
PS C:\> $SubscriptionId = "81b59010-dc55-45b7-89cd-5ca26db62472"
PS C:\> $ClassicRunAsAccountCertifcateAssetName = "AzureClassicRunAsCertificate"
PS C:\> $ClassicRunAsAccountConnectionFieldValues = @{"SubscriptionName" = $SubscriptionName; "SubscriptionId" = $SubscriptionId; "CertificateAssetName" = $ClassicRunAsAccountCertifcateAssetName}
PS C:\> New-AzAutomationConnection -Name "Connection14" -ConnectionTypeName AzureClassicCertificate  -ConnectionFieldValues $ClassicRunAsAccountConnectionFieldValues -ResourceGroupName "ResourceGroup01" -AutomationAccountName "AutomationAccount01"

The command creates an Azure connection named Connection14 in the Automation account named AutomationAccount01 using $ClassicRunAsAccountConnectionFieldValues and ConnectionTypeName=AzureClassicCertificate. This ConnectionTypeName=AzureClassicCertificate is mainly used for Azure Classic Run As Account.

Parameters

-AutomationAccountName

Specifies the name of the Automation account for which this cmdlet creates a connection.

Type:String
Position:1
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ConnectionFieldValues

Specifies a hash table that contains key/value pairs. The keys represent the connection fields for the specified connection type. The values represent the specific values of each connection field for the connection instance.

Type:IDictionary
Position:4
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ConnectionTypeName

Specifies the name of the connection type.

Type:String
Position:3
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Description

Specifies a description for the connection.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Name

Specifies a name for the connection.

Type:String
Position:2
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of the resource group for which this cmdlet creates a connection.

Type:String
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

IDictionary

Outputs

Connection