Edit

Share via


New-AzAutomationConnection

Creates an Automation connection.

Syntax

Default (Default)

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

$FieldValues = @{"AutomationCertificateName"="ContosoCertificate";"SubscriptionID"="81b59010-dc55-45b7-89cd-5ca26db62472"}
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

$Thumbprint = "0SZTNJ34TCCMUJ5MJZGR8XQD3S0RVHJBA33Z8ZXV"
$TenantId = "00001111-aaaa-2222-bbbb-3333cccc4444"
$ApplicationId = "00001111-aaaa-2222-bbbb-3333cccc4444"
$SubscriptionId = "81b59010-dc55-45b7-89cd-5ca26db62472"
$RunAsAccountConnectionFieldValues = @{"ApplicationId" = $ApplicationId; "TenantId" = $TenantId; "CertificateThumbprint" = $Thumbprint; "SubscriptionId" = $SubscriptionId}
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

$SubscriptionName = "MyTestSubscription"
$SubscriptionId = "81b59010-dc55-45b7-89cd-5ca26db62472"
$ClassicRunAsAccountCertifcateAssetName = "AzureClassicRunAsCertificate"
$ClassicRunAsAccountConnectionFieldValues = @{"SubscriptionName" = $SubscriptionName; "SubscriptionId" = $SubscriptionId; "CertificateAssetName" = $ClassicRunAsAccountCertifcateAssetName}
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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:IDictionary
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:4
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ConnectionTypeName

Specifies the name of the connection type.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Description

Specifies a description for the connection.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

Specifies a name for the connection.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceGroupName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

IDictionary

Outputs

Connection