New-AzureAutomationCredential
Syntax
New-AzureAutomationCredential
-AutomationAccountName <String>
[-Description <String>]
-Name <String>
[-Profile <AzureSMProfile>]
-Value <PSCredential>
[<CommonParameters>]
Description
The New-AzureAutomationCredential cmdlet creates a credential as a PSCredential object in Microsoft Azure Automation.
Examples
Example 1: Create a credential
PS C:\> $user = "MyDomain\MyUser"
PS C:\> $pw = ConvertTo-SecureString "PassWord!" -AsPlainText -Force
PS C:\> $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user, $pw
PS C:\> New-AzureAutomationCredential -AutomationAccountName "Contoso17" -Name "MyCredential" -Value $cred
These commands create a credential named MyCredential. A credential object is first created that includes a username and password. This is then used in the last command to create the Automation credential.
Required Parameters
Specifies the name of the Automation account the credential will be stored in.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True (ByPropertyName) |
| Accept wildcard characters: | False |
Specifies a name for the credential.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True (ByPropertyName) |
| Accept wildcard characters: | False |
Specifies the credentials as a PSCredential object.
| Type: | PSCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True (ByPropertyName) |
| Accept wildcard characters: | False |
Optional Parameters
Specifies a description for the credential.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True (ByPropertyName) |
| Accept wildcard characters: | False |
Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.
| Type: | AzureSMProfile |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Outputs
Microsoft.Azure.Commands.Automation.Model.CredentialInfo