Skip to content

Commit 2d87f6b

Browse files
Merge pull request #234211 from SnehaSudhirG/12Apr-RunAsDocUpdates
Feedback incorporated for RunAs Accounts
2 parents 1248b97 + cf1f51a commit 2d87f6b

7 files changed

+33
-36
lines changed

articles/automation/automation-connections.md

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Manage connections in Azure Automation
33
description: This article tells how to manage Azure Automation connections to external services or applications and how to work with them in runbooks.
44
services: automation
55
ms.subservice: shared-capabilities
6-
ms.date: 12/22/2020
6+
ms.date: 04/12/2023
77
ms.topic: conceptual
88
ms.custom: devx-track-azurepowershell
99
---
@@ -27,10 +27,8 @@ When you create a connection, you must specify a connection type. The connection
2727
Azure Automation makes the following built-in connection types available:
2828

2929
* `Azure` - Represents a connection used to manage classic resources.
30-
* `AzureServicePrincipal` - Represents a connection used by the Azure Run As account.
31-
* `AzureClassicCertificate` - Represents a connection used by the classic Azure Run As account.
32-
33-
In most cases, you don't need to create a connection resource because it is created when you create a [Run As account](automation-security-overview.md).
30+
* `AzureServicePrincipal` - Represents a connection used to manage resources in Azure using a service principal.
31+
* `AzureClassicCertificate` - This connection type is used to manage resources in Azure that were created using the classic deployment model that doesn't support Service Principal authentication.
3432

3533
## PowerShell cmdlets to access connections
3634

@@ -80,15 +78,15 @@ To create a new connection in the Azure portal:
8078

8179
Create a new connection with Windows PowerShell using the `New-AzAutomationConnection` cmdlet. This cmdlet has a `ConnectionFieldValues` parameter that expects a hashtable defining values for each of the properties defined by the connection type.
8280

83-
You can use the following example commands as an alternative to creating the Run As account from the portal to create a new connection asset.
81+
You can use the following example commands to create a connection that can be used for authentication using Azure Service Principal.
8482

8583
```powershell
86-
$ConnectionAssetName = "AzureRunAsConnection"
84+
$ConnectionAssetName = "AzureConnection"
8785
$ConnectionFieldValues = @{"ApplicationId" = $Application.ApplicationId; "TenantId" = $TenantID.TenantId; "CertificateThumbprint" = $Cert.Thumbprint; "SubscriptionId" = $SubscriptionId}
8886
New-AzAutomationConnection -ResourceGroupName $ResourceGroup -AutomationAccountName $AutomationAccountName -Name $ConnectionAssetName -ConnectionTypeName AzureServicePrincipal -ConnectionFieldValues $ConnectionFieldValues
8987
```
9088

91-
When you create your Automation account, it includes several global modules by default, along with the connection type `AzureServicePrincipal` to create the `AzureRunAsConnection` connection asset. If you try to create a new connection asset to connect to a service or application with a different authentication method, the operation fails because the connection type is not already defined in your Automation account. For more information on creating your own connection type for a custom module, see [Add a connection type](#add-a-connection-type).
89+
If you try to create a new connection asset to connect to a service or application with a different authentication method, the operation fails because the connection type is not already defined in your Automation account. For more information on creating your own connection type for a custom module, see [Add a connection type](#add-a-connection-type).
9290

9391
## Add a connection type
9492

@@ -123,38 +121,38 @@ Retrieve a connection in a runbook or DSC configuration with the internal `Get-A
123121

124122
# [PowerShell](#tab/azure-powershell)
125123

126-
The following example shows how to use the Run As account to authenticate with Azure Resource Manager resources in your runbook. It uses a connection asset representing the Run As account, which references the certificate-based service principal.
124+
The following example shows how to use a connection to authenticate with Azure Resource Manager resources in your runbook. It uses a connection asset, which references the certificate-based service principal.
127125

128126
```powershell
129-
$Conn = Get-AutomationConnection -Name AzureRunAsConnection
127+
$Conn = Get-AutomationConnection -Name AzureConnection
130128
Connect-AzAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint
131129
```
132130

133131
# [Python](#tab/python2)
134132

135-
The following example shows how to authenticate using the Run As connection in a Python 2 and 3 runbook.
133+
The following example shows how to authenticate using connection in a Python 2 and 3 runbook.
136134

137135
```python
138136
""" Tutorial to show how to authenticate against Azure resource manager resources """
139137
import azure.mgmt.resource
140138
import automationassets
141139

142-
def get_automation_runas_credential(runas_connection):
140+
def get_automation_credential(azure_connection):
143141
""" Returns credentials to authenticate against Azure resource manager """
144142
from OpenSSL import crypto
145143
from msrestazure import azure_active_directory
146144
import adal
147145

148-
# Get the Azure Automation Run As service principal certificate
149-
cert = automationassets.get_automation_certificate("AzureRunAsCertificate")
146+
# Get the Azure Automation service principal certificate
147+
cert = automationassets.get_automation_certificate("MyCertificate")
150148
pks12_cert = crypto.load_pkcs12(cert)
151149
pem_pkey = crypto.dump_privatekey(
152150
crypto.FILETYPE_PEM, pks12_cert.get_privatekey())
153151

154-
# Get Run As connection information for the Azure Automation service principal
155-
application_id = runas_connection["ApplicationId"]
156-
thumbprint = runas_connection["CertificateThumbprint"]
157-
tenant_id = runas_connection["TenantId"]
152+
# Get information for the Azure Automation service principal
153+
application_id = my_connection["ApplicationId"]
154+
thumbprint = my_connection["CertificateThumbprint"]
155+
tenant_id = my_connection["TenantId"]
158156

159157
# Authenticate with service principal certificate
160158
resource = "https://management.core.windows.net/"
@@ -169,10 +167,10 @@ def get_automation_runas_credential(runas_connection):
169167
)
170168

171169

172-
# Authenticate to Azure using the Azure Automation Run As service principal
173-
runas_connection = automationassets.get_automation_connection(
174-
"AzureRunAsConnection")
175-
azure_credential = get_automation_runas_credential(runas_connection)
170+
# Authenticate to Azure using the Azure Automation service principal
171+
azure_connection = automationassets.get_automation_connection(
172+
"AzureConnection")
173+
azure_credential = get_automation_credential(azure_connection)
176174
```
177175

178176
---
@@ -183,7 +181,7 @@ You can add an activity for the internal `Get-AutomationConnection` cmdlet to a
183181

184182
![add to canvas](media/automation-connections/connection-add-canvas.png)
185183

186-
The following image shows an example of using a connection object in a graphical runbook. This example uses the `Constant value` data set for the `Get RunAs Connection` activity, which uses a connection object for authentication. A [pipeline link](automation-graphical-authoring-intro.md#use-links-for-workflow) is used here since the `ServicePrincipalCertificate` parameter set is expecting a single object.
184+
The following image shows an example of using a connection object in a graphical runbook.
187185

188186
![get connections](media/automation-connections/automation-get-connection-object.png)
189187

articles/automation/automation-powershell-workflow.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Learn PowerShell Workflow for Azure Automation
33
description: This article teaches you the differences between PowerShell Workflow and PowerShell and concepts applicable to Automation runbooks.
44
services: automation
55
ms.subservice: process-automation
6-
ms.date: 10/16/2022
6+
ms.date: 04/12/2023
77
ms.topic: conceptual
88
ms.custom: devx-track-azurepowershell
99
---
@@ -153,7 +153,7 @@ For more information on using InlineScript, see [Running Windows PowerShell Comm
153153

154154
One advantage of Windows PowerShell Workflows is the ability to perform a set of commands in parallel instead of sequentially as with a typical script.
155155

156-
You can use the `Parallel` keyword to create a script block with multiple commands that run concurrently. This uses the following syntax shown below. In this case, Activity1 and Activity2 starts at the same time. Activity3 starts only after both Activity1 and Activity2 have completed.
156+
You can use the `Parallel` keyword to create a script block with multiple commands that run concurrently. This uses the following syntax shown below. In this case, Activity1 and Activity2 start at the same time. Activity3 starts only after both Activity1 and Activity2 have completed.
157157

158158
```powershell
159159
Parallel
@@ -286,7 +286,7 @@ workflow CreateTestVms
286286
```
287287

288288
> [!NOTE]
289-
> For non-graphical PowerShell runbooks, `Add-AzAccount` and `Add-AzureRMAccount` are aliases for [Connect-AzAccount](/powershell/module/az.accounts/connect-azaccount). You can use these cmdlets or you can [update your modules](automation-update-azure-modules.md) in your Automation account to the latest versions. You might need to update your modules even if you have just created a new Automation account. Use of these cmdlets is not required if you are authenticating using a Run As account configured with a service principal.
289+
> For non-graphical PowerShell runbooks, `Add-AzAccount` and `Add-AzureRMAccount` are aliases for [Connect-AzAccount](/powershell/module/az.accounts/connect-azaccount). You can use these cmdlets or you can [update your modules](automation-update-azure-modules.md) in your Automation account to the latest versions. You might need to update your modules even if you have just created a new Automation account.
290290
291291
For more information about checkpoints, see [Adding Checkpoints to a Script Workflow](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj574114(v=ws.11)).
292292

97.1 KB
Loading

articles/automation/quickstart-create-automation-account-template.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Create an Azure Automation account using a Resource Manager template
33
titleSuffix: Azure Automation
44
description: This article shows how to create an Automation account by using the Azure Resource Manager template.
55
services: automation
6-
ms.date: 08/27/2021
6+
ms.date: 04/12/2023
77
ms.topic: conceptual
88
ms.workload: infrastructure-services
99
ms.custom: mvc, subject-armqs, mode-arm, devx-track-arm-template
@@ -22,9 +22,6 @@ The sample template does the following steps:
2222
* Links the Automation account to the Log Analytics workspace.
2323
* Adds sample Automation runbooks to the account.
2424

25-
> [!NOTE]
26-
> Creation of the Automation Run As account is not supported when you're using an ARM template. To create a Run As account manually from the portal or with PowerShell, see [Create Run As account](create-run-as-account.md).
27-
2825
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
2926

3027
## Prerequisites

articles/automation/quickstarts/create-azure-automation-account-portal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Quickstart - Create an Azure Automation account using the portal
33
description: This quickstart helps you to create a new Automation account using Azure portal.
44
services: automation
5-
ms.date: 10/26/2021
5+
ms.date: 04/12/2023
66
ms.topic: quickstart
77
ms.subservice: process-automation
88
ms.custom: mvc, mode-ui

articles/automation/quickstarts/dsc-configuration.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: This article helps you get started configuring an Azure VM with Des
44
services: automation
55
ms.subservice: dsc
66
keywords: dsc, configuration, automation
7-
ms.date: 09/01/2021
7+
ms.date: 04/12/2023
88
ms.topic: quickstart
99
ms.custom: mvc, mode-other
1010
---
@@ -18,7 +18,6 @@ By enabling Azure Automation State Configuration, you can manage and monitor the
1818
To complete this quickstart, you need:
1919

2020
* An Azure subscription. If you don't have an Azure subscription, [create a free account](https://azure.microsoft.com/free/).
21-
* An Azure Automation account. For instructions on creating an Azure Automation Run As account, see [Azure Run As Account](../manage-runas-account.md).
2221
* An Azure Resource Manager virtual machine running Red Hat Enterprise Linux, CentOS, or Oracle Linux. For instructions on creating a VM, see [Create your first Linux virtual machine in the Azure portal](../../virtual-machines/linux/quick-create-portal.md)
2322

2423
## Sign in to Azure
@@ -33,7 +32,7 @@ There are many different methods to enable a machine for Automation State Config
3332
1. From the left pane of the Automation account, select **State configuration (DSC)**.
3433
2. Click **Add** to open the **VM select** page.
3534
3. Find the virtual machine for which to enable DSC. You can use the search field and filter options to find a specific virtual machine.
36-
4. Click on the virtual machine, and then click **Connect**
35+
4. Click on the virtual machine, and then click **Connect**.
3736
5. Select the DSC settings appropriate for the virtual machine. If you have already prepared a configuration, you can specify it as `Node Configuration Name`. You can set the [configuration mode](/powershell/dsc/managing-nodes/metaConfig) to control the configuration behavior for the machine.
3837
6. Click **OK**. While the DSC extension is deployed to the virtual machine, the status reported is `Connecting`.
3938

articles/automation/source-control-integration.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Use source control integration in Azure Automation
33
description: This article tells you how to synchronize Azure Automation source control with other repositories.
44
services: automation
55
ms.subservice: process-automation
6-
ms.date: 11/22/2021
6+
ms.date: 04/12/2023
77
ms.topic: conceptual
88
ms.custom: devx-track-azurepowershell
99
---
@@ -36,7 +36,10 @@ Azure Automation supports three types of source control:
3636
>
3737
> :::image type="content" source="./media/source-control-integration/user-assigned-managed-identity.png" alt-text="Screenshot that displays the user-assigned Managed Identity.":::
3838
>
39-
> If you have both a Run As account and managed identity enabled, then managed identity is given preference. If you want to use a Run As account instead, you can [create an Automation variable](./shared-resources/variables.md) of BOOLEAN type named `AUTOMATION_SC_USE_RUNAS` with a value of `true`.
39+
> If you have both a Run As account and managed identity enabled, then managed identity is given preference.
40+
41+
> [!Important]
42+
> Azure Automation Run As Account will retire on **September 30, 2023** and will be replaced with Managed Identities. Before that date, you need to [migrate from a Run As account to Managed identities](migrate-run-as-accounts-managed-identity.md).
4043
4144
> [!NOTE]
4245
> According to [this](/azure/devops/organizations/accounts/change-application-access-policies?view=azure-devops#application-connection-policies) Azure DevOps documentation, **Third-party application access via OAuth** policy is defaulted to **off** for all new organizations. So if you try to configure source control in Azure Automation with **Azure Devops (Git)** as source control type without enabling **Third-party application access via OAuth** under Policies tile of Organization Settings in Azure DevOps then you might get **SourceControl securityToken is invalid** error. Hence to avoid this error, make sure you first enable **Third-party application access via OAuth** under Policies tile of Organization Settings in Azure DevOps.

0 commit comments

Comments
 (0)