Skip to content

Latest commit

 

History

History
192 lines (148 loc) · 6.43 KB

File metadata and controls

192 lines (148 loc) · 6.43 KB
external help file Microsoft.Azure.PowerShell.Cmdlets.Automation.dll-Help.xml
Module Name Az.Automation
ms.assetid 95103160-8101-4C43-8DAA-0BD75DFF3150
online version https://learn.microsoft.com/powershell/module/az.automation/new-azautomationconnection
schema 2.0.0
content_git_url https://github.com/Azure/azure-powershell/blob/main/src/Automation/Automation/help/New-AzAutomationConnection.md
original_content_git_url https://github.com/Azure/azure-powershell/blob/main/src/Automation/Automation/help/New-AzAutomationConnection.md

New-AzAutomationConnection

SYNOPSIS

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

$FieldValues = @{"AutomationCertificateName"="ContosoCertificate";"SubscriptionID"="aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e"}
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 = "AA11BB22CC33DD44EE55FF66AA77BB88CC99DD00"
$TenantId = "aaaabbbb-0000-cccc-1111-dddd2222eeee"
$ApplicationId = "00001111-aaaa-2222-bbbb-3333cccc4444"
$SubscriptionId = "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e"
$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 = "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e"
$ClassicRunAsAccountCertificateAssetName = "AzureClassicRunAsCertificate"
$ClassicRunAsAccountConnectionFieldValues = @{"SubscriptionName" = $SubscriptionName; "SubscriptionId" = $SubscriptionId; "CertificateAssetName" = $ClassicRunAsAccountCertificateAssetName}
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: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
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: System.Collections.IDictionary
Parameter Sets: (All)
Aliases:

Required: True
Position: 4
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ConnectionTypeName

Specifies the name of the connection type.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
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
Parameter Sets: (All)
Aliases: AzContext, AzureRmContext, AzureCredential

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Description

Specifies a description for the connection.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Name

Specifies a name for the connection.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ResourceGroupName

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

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

CommonParameters

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

INPUTS

System.String

System.Collections.IDictionary

OUTPUTS

Microsoft.Azure.Commands.Automation.Model.Connection

NOTES

RELATED LINKS

Get-AzAutomationConnection

Remove-AzAutomationConnection