title | description | services | documentationcenter | author | manager | editor | keywords | ms.assetid | ms.service | ms.devlang | ms.topic | ms.tgt_pltfrm | ms.workload | ms.date | ms.author |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Create Azure AD User Account | Microsoft Docs |
This article describes how to create an Azure AD User account credential for runbooks in Azure Automation to authenticate in Azure and classic Azure. |
automation |
eslesar |
jwhit |
tysonn |
azure active directory user, azure service management, azure ad user account |
fcfe266d-b22e-4dfb-8272-adcab09fc0cf |
automation |
na |
get-started-article |
na |
infrastructure-services |
04/13/2017 |
magoedte |
This article describes the steps you must perform to configure an Azure AD User account for Azure Automation runbooks running against Azure classic deployment model or Azure Resource Manager resources. While this continues to be a supported authentication identity for your Azure Resource Manager based runbooks, the recommended method is using an Azure Run As account.
- Log in to the Azure Classic portal as a service administrator for the Azure subscription you want to manage.
- Select Active Directory, and then select the name of your organization directory.
- Select the Users tab, and then, in the command area, select Add User.
- On the Tell us about this user page, under Type of user, select New user in your organization.
- Enter a user name.
- Select the directory name that is associated with your Azure subscription on the Active Directory page.
- On the user profile page, provide a first and last name, a user-friendly name, and User from the Roles list. Do not Enable Multi-Factor Authentication.
- Note the user’s full name and temporary password.
- Select Settings > Administrators > Add.
- Type the full user name of the user that you created.
- Select the subscription that you want the user to manage.
- Log out of Azure and then log back in with the account you just created. You will be prompted to change the user’s password.
In this section, you perform the following steps to create an Azure Automation account in the Azure portal for use with your runbooks managing resources in Azure classic deployment.
Note
Automation accounts created with the Azure Classic portal can be managed by both the Azure Classic and Azure portal and either set of cmdlets. Once the account is created, it makes no difference how you create and manage resources within the account. If you are planning to continue to use the Azure Classic portal, then you should use it instead of the Azure portal to create any Automation accounts.
- Log in to the Azure Classic portal as a service administrator for the Azure subscription you want to manage.
- Select Automation.
- On the Automation page, select Create an Automation Account.
- In the Create an Automation Account box, type in a name for your new Automation account and select a Region from the drop-down list.
- Click OK to accept your settings and create the account.
- After it is created it will be listed on the Automation page.
- Click on the account and it will bring you to the Dashboard page.
- On the Automation Dashboard page, select Assets.
- On the Assets page, select Add Settings located at the bottom of the page.
- On the Add Settings page, select Add Credential.
- On the Define Credential page, select Windows PowerShell Credential from the Credential Type drop-down list and provide a name for the credential.
- On the following Define Credential page type in the username of the AD user account created earlier in the User Name field and the password in the Password and Confirm Password fields. Click OK to save your changes.
In this section, perform the following steps to create an Azure Automation account in the Azure portal for use with your runbooks managing resources in Azure Resource Manager mode.
-
Log in to the Azure portal as a service administrator for the Azure subscription you want to manage.
-
Select Automation Accounts.
-
In the Add Automation Account blade, in the Name box type in a name for your new Automation account.
-
If you have more than one subscription, specify the one for the new account, as well as a new or existing Resource group and an Azure datacenter Location.
-
Select the value Yes for the Create Azure Run As account option, and click the Create button.
[!NOTE] If you choose to not create the Run As account by selecting the option No, you will be presented with a warning message in the Add Automation Account blade. While the account is created and assigned to the Contributor role in the subscription, it will not have a corresponding authentication identity within your subscriptions directory service and therefore, no access resources in your subscription. This will prevent any runbooks referencing this account from being able to authenticate and perform tasks against Azure Resource Manager resources.
-
While Azure creates the Automation account, you can track the progress under Notifications from the menu.
When the creation of the credential is completed, you need to create a Credential Asset to associate the Automation Account with the AD User account created earlier. Remember, we only created the Automation account and it is not associated with an authentication identity. Perform the steps outlined in the Credential assets in Azure Automation article and enter the value for username in the format domain\user.
You can retrieve the credential in a runbook using the Get-AutomationPSCredential activity and then use it with Add-AzureAccount to connect to your Azure subscription. If the credential is an administrator of multiple Azure subscriptions, then you should also use Select-AzureSubscription to specify the correct one. This is shown in the sample Windows PowerShell below that will typically appear at the top of most Azure Automation runbooks.
$cred = Get-AutomationPSCredential –Name "myuseraccount.onmicrosoft.com"
Add-AzureAccount –Credential $cred
Select-AzureSubscription –SubscriptionName "My Subscription"
You should repeat these lines after any checkpoints in your runbook. If the runbook is suspended and then resumes on another worker, then it will need to perform the authentication again.
- Review the different runbook types and steps for creating your own runbooks from the following article Azure Automation runbook types