< Back

New-AzureRmAutomationCredential

Tue Jan 29, 2019 9:32 pm

NAME New-AzureRmAutomationCredential



SYNOPSIS

Creates an Automation credential.





SYNTAX

New-AzureRmAutomationCredential [-ResourceGroupName] <String> [-AutomationAccountName] <String> [-Name] <String> [-Value] <PSCredential>

[-DefaultProfile <IAzureContextContainer>] [-Description <String>] [<CommonParameters>]





DESCRIPTION

The New-AzureRmAutomationCredential cmdlet creates a credential as a PSCredential object in Azure Automation.





PARAMETERS

-AutomationAccountName <String>

Specifies the name of the Automation account in which this cmdlet stores the credential.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Description <String>

Specifies a description for the credential.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Name <String>

Specifies a name for the credential.



Required? true

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ResourceGroupName <String>

Specifies a description for the resource group for which this cmdlet creates a credential.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Value <PSCredential>

Specifies the credentials as a PSCredential object.



Required? true

Position? 3

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Commands.Automation.Model.CredentialInfo







NOTES









Example 1: Create a credential



PS C:\\>$User = "Contoso\\PFuller"

PS C:\\> $Password = ConvertTo-SecureString "Password" -AsPlainText -Force

PS C:\\> $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $Password

PS C:\\> New-AzureRmAutomationCredential -AutomationAccountName "Contoso17" -Name "ContosoCredential" -Value $Credential -ResourceGroupName

"ResourceGroup01"



The first command assigns a user name to the $User variable.



The second command converts a plain text password into a secure string by using the ConvertTo-SecureString cmdlet. The command stores that object

in the $Password variable.



The third command creates a credential based on $User and $Password, and then stores it in the $Credential variable.



The final command creates an Automation credential named ContosoCredential that uses $Credential.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... credential

Get-AzureRmAutomationCredential

Remove-AzureRmAutomationCredential

Set-AzureRmAutomationCredential