New-AzAutomationCredential
Creates an Automation credential.
Note
This is the previous version of our documentation. Please consult the most recent version for up-to-date information.
Syntax
New-AzAutomationCredential
[-Name] <String>
[-Description <String>]
[-Value] <PSCredential>
[-ResourceGroupName] <String>
[-AutomationAccountName] <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The New-AzAutomationCredential cmdlet creates a credential as a PSCredential object in Azure Automation.
Examples
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-AzAutomationCredential -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.
Parameters
Specifies the name of the Automation account in which this cmdlet stores the credential.
| Type: | String |
| Position: | 1 |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with azure
| Type: | IAzureContextContainer |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies a description for the credential.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Specifies a name for the credential.
| Type: | String |
| Position: | 2 |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Specifies a description for the resource group for which this cmdlet creates a credential.
| Type: | String |
| Position: | 0 |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Specifies the credentials as a PSCredential object.
| Type: | PSCredential |
| Position: | 3 |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |