Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
New-AzAutomationCredential
- Module:
- Az.Automation Module
Creates an Automation credential.
Syntax
Default (Default)
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
$User = "Contoso\PFuller"
$Password = ConvertTo-SecureString -String "****" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $Password
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
-AutomationAccountName
Specifies the name of the Automation account in which this cmdlet stores the credential.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-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
-Description
Specifies a description for the credential.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Name
Specifies a name for the credential.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
Specifies a description for the resource group for which this cmdlet creates a credential.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Value
Specifies the credentials as a PSCredential object.
Parameter properties
| Type: | PSCredential |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
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
PSCredential
Outputs
CredentialInfo
Related Links
Azure PowerShell
Feedback
Was this page helpful?
