You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/automation/shared-resources/credentials.md
+22-6Lines changed: 22 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ manager: carmonm
12
12
---
13
13
# Credential assets in Azure Automation
14
14
15
-
An Automation credential asset holds an object that contains security credentials such as a username and a password. Runbooks and DSC configurations use cmdlets that accept a `PSCredential` object for authentication. Alternatively, they can extract the username and password of the `PSCredential` object to provide to some application or service requiring authentication. Azure Automation securely stores the properties of a credential and allows their access in a runbook or DSC configuration with the [Get-AutomationPSCredential](#activities) activity.
15
+
An Automation credential asset holds an object that contains security credentials such as a username and a password. Runbooks and DSC configurations use cmdlets that accept a [PSCredential](https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.pscredential?view=pscore-6.2.0) object for authentication. Alternatively, they can extract the username and password of the `PSCredential` object to provide to some application or service requiring authentication. Azure Automation securely stores the properties of a credential and access to the properties in a runbook or DSC configuration with the [Get-AutomationPSCredential](#activities-used-to-access-credentials) activity.
16
16
17
17
> [!NOTE]
18
18
> Secure assets in Azure Automation include credentials, certificates, connections, and encrypted variables. These assets are encrypted and stored in Azure Automation using a unique key that is generated for each automation account. This key is stored in Key Vault. Before storing a secure asset, the key is loaded from Key Vault and then used to encrypt the asset.
@@ -32,11 +32,27 @@ For the Azure PowerShell Az module, the cmdlets in the following table are used
32
32
33
33
## Activities used to access credentials
34
34
35
-
The activities in the following table are used to access credentials in runbooksand DSC configurations.
35
+
The activities in the following table are used to access credentials in runbooks and DSC configurations.
36
36
37
37
| Activity | Description |
38
38
|:--- |:--- |
39
-
|`Get-AutomationPSCredential`|Gets a credential to use in a runbook or DSC configuration. The credential is in the form of a [System.Management.Automation.PSCredential](/dotnet/api/system.management.automation.pscredential) object. |
39
+
|`Get-AutomationPSCredential`|Gets a credential to use in a runbook or DSC configuration. The credential is in the form of a `PSCredential` object. |
40
+
|[Get-Credential](https://docs.microsoft.com/powershell/module/microsoft.powershell.security/get-credential?view=powershell-7)|Gets a credential with a prompt for username and password. |
41
+
|[New-AzureAutomationCredential](https://docs.microsoft.com/powershell/module/servicemanagement/azure/new-azureautomationcredential?view=azuresmps-4.0.0)| Creates a credential asset. |
42
+
43
+
For local development using the Azure Automation Authoring Toolkit, the `Get-AutomationPSCredential` cmdlet is part of assembly [AzureAutomationAuthoringToolkit](https://www.powershellgallery.com/packages/AzureAutomationAuthoringToolkit/0.2.3.9). For Azure working with the Automation context, the cmdlet is in `Orchestrator.AssetManagement.Cmdlets`. See [Manage modules in Azure Automation](https://docs.microsoft.com/en-us/azure/automation/shared-resources/modules).
44
+
45
+
To be able to retrieve `PSCredential` objects in your code, you can install the [Microsoft Azure Automation ISE add-on for the PowerShell ISE](https://github.com/azureautomation/azure-automation-ise-addon).
> You should avoid using variables in the `Name` parameter of `Get-AutomationPSCredential`. Their use can complicate discovery of dependencies between runbooks or DSC configurations and credential assets at design time.
@@ -54,7 +70,7 @@ The function in the following table is used to access credentials in a Python2 r
54
70
55
71
## Creating a new credential asset
56
72
57
-
### To create a new credential asset with the Azure portal
73
+
### Create a new credential asset with the Azure portal
58
74
59
75
1. From your automation account, select **Credentials** under **Shared Resources**.
60
76
1. Select **Add a credential**.
@@ -67,7 +83,7 @@ The function in the following table is used to access credentials in a Python2 r
67
83
> [!NOTE]
68
84
> User accounts that use multi-factor authentication are not supported for use in Azure Automation.
69
85
70
-
### To create a new credential asset with Windows PowerShell
86
+
### Create a new credential asset with Windows PowerShell
71
87
72
88
The following example shows how to create a new Automation credential asset. A `PSCredential` object is first created with the name and password, and then used to create the credential asset. Alternatively, you can use the `Get-Credential` cmdlet to prompt the user to type in a name and password.
A runbook or DSC configuration retrieves a credential asset with the `Get-AutomationPSCredential` activity. This activity returns a [PSCredential object](/dotnet/api/system.management.automation.pscredential) that you can use with an activity or cmdlet that requires a credential. You can also retrieve the properties of the credential object to use individually. The object has properties for the username and the secure password. Alternatively you can use the `GetNetworkCredential` method to return a [NetworkCredential](/dotnet/api/system.net.networkcredential) object that represents an unsecured version of the password.
99
+
A runbook or DSC configuration retrieves a credential asset with the `Get-AutomationPSCredential` activity. This activity retrieves a `PSCredential` object that that you can use with an activity or cmdlet that requires a credential. You can also retrieve the properties of the credential object to use individually. The object has properties for the username and the secure password. Alternatively you can use the [GetNetworkCredential](https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.pscredential.getnetworkcredential?view=pscore-6.2.0) method to retrieve a [NetworkCredential](/dotnet/api/system.net.networkcredential) object that represents an unsecured version of the password.
84
100
85
101
> [!NOTE]
86
102
> `Get-AzAutomationCredential` does not retrieve a `PSCredential` object that can be used for authentication. It only provides information about the credential. If you need to use a credential in a runbook, you must retrieve it as a `PSCredential` object using `Get-AutomationPSCredential`.
0 commit comments