Skip to content

Commit b8e1131

Browse files
committed
Adding new conceptual file
1 parent 9f6c6c3 commit b8e1131

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

articles/automation/shared-resources/credentials.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ manager: carmonm
1212
---
1313
# Credential assets in Azure Automation
1414

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.
1616

1717
> [!NOTE]
1818
> 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
3232

3333
## Activities used to access credentials
3434

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.
3636

3737
| Activity | Description |
3838
|:--- |:--- |
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).
46+
47+
```azurepowershell
48+
Install-Module AzureAutomationAuthoringToolkit -Scope CurrentUser -Force
49+
```
50+
51+
Your script can also import the required module where needed, as in the following example:
52+
53+
```azurepowershell
54+
Import-Module Orchestrator.AssetManagement.Cmdlets -ErrorAction SilentlyContinue
55+
```
4056

4157
> [!NOTE]
4258
> 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
5470
5571
## Creating a new credential asset
5672

57-
### To create a new credential asset with the Azure portal
73+
### Create a new credential asset with the Azure portal
5874

5975
1. From your automation account, select **Credentials** under **Shared Resources**.
6076
1. Select **Add a credential**.
@@ -67,7 +83,7 @@ The function in the following table is used to access credentials in a Python2 r
6783
> [!NOTE]
6884
> User accounts that use multi-factor authentication are not supported for use in Azure Automation.
6985
70-
### To create a new credential asset with Windows PowerShell
86+
### Create a new credential asset with Windows PowerShell
7187

7288
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.
7389

@@ -80,7 +96,7 @@ New-AzureAutomationCredential -AutomationAccountName "MyAutomationAccount" -Name
8096

8197
## Using a PowerShell credential
8298

83-
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.
84100

85101
> [!NOTE]
86102
> `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

Comments
 (0)