# How to Set Up Azure Automation for Agent Installation Last Updated On: 05 Aug 2026 ## Overview This document outlines the steps to set up Azure Automation for agent installation in virtual machine. It provides detailed instructions for downloading agent files, creating storage and automation accounts, and managing roles and runbooks in Azure. By following these steps, you will be able to automate the installation of agents in your Azure environment efficiently. ## Prerequisites - **Azure Subscription**: Ensure you have an active Azure subscription. - **Automation Account**: Create an Automation account to manage runbooks and authenticate to Azure resources. - **Storage Account**: Create a storage account to store agent binaries and scripts. ## Step 1: Download the Agent Installation Files 1. **Access Endpoint Central** - Log in to the Endpoint Central web console. - Navigate to **Agent** > **Computers**. - Select the remote office and click on **Download Agent**. ## Step 2: Create a Storage Account 1. **Login to the Azure Portal**. 2. **Create a Storage Account** - Go to **All services** and select **Storage Accounts**. ![Selecting Storage Accounts from All services in the Azure portal](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice1.webp) ![The Azure Storage Accounts page](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice2.webp) - Click on the Create Storage Account. ![Clicking Create on the Storage Accounts page](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice3.webp) - Enter the storage account name: **ecagentbinary**. ![Entering the storage account name ecagentbinary](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice4.webp) > **Note:** If you use a different name, update the Automation runbook script accordingly. - Modify default settings as needed and click **Create**. ![Reviewing storage account settings before clicking Create](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice5.webp) - Wait for the deployment to finish, then click **Go to resource**. ![Storage account deployment complete, with the Go to resource option](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice6.webp) 3. **Upload the Agent File** - In the storage account, navigate to **Overview** and click **Upload**. ![Clicking Upload from the storage account Overview page](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice7.webp) - Upload the file: **Downloaded Agent File**. ![Selecting the downloaded agent installer file to upload](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice8.webp) - Set the container name as **scriptcontainer**. ![Setting the container name to scriptcontainer during upload](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice9.webp) > **Note:** If you use a different name, update the Automation runbook script accordingly. - After the upload completes, go to the **Containers** tab and open **scriptcontainer**. ![Opening scriptcontainer from the Containers tab](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice10.webp) ![scriptcontainer showing the uploaded agent file](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice11.webp) 4. **Generate a SAS Token** - Right-click on **LocalOffice_Agent.exe** and select **Generate SAS**. ![Selecting Generate SAS on LocalOffice_Agent.exe](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice12.webp) - Set the expiration date and allowed protocol, then click **Generate SAS token and URL**. ![Setting the expiration date and allowed protocol for the SAS token](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice13.webp) - Copy the **Blob SAS URL**. ![Copying the generated Blob SAS URL](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice14.webp) 5. **Prepare the Installation Script** - Download the [attached script](https://www.manageengine.com/products/desktop-central/scripts/InstallAgentAzure.ps1) and open it in a text editor. - Replace the placeholder `LocalOffice_Agent.exe Agent_MSI_URL` with the **Blob SAS URL**. ![Replacing the placeholder in the script with the Blob SAS URL](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice15.webp) - Save the file as **InstallAgentAzure.ps1**. - Upload **InstallAgentAzure.ps1** to the same **scriptcontainer**. ![Uploading InstallAgentAzure.ps1 to the scriptcontainer](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice16.webp) ## Finalize Storage Container Contents Your **scriptcontainer** should now contain: - **LocalOffice_Agent.exe** - **InstallAgentAzure.ps1** ![scriptcontainer showing LocalOffice_Agent.exe and InstallAgentAzure.ps1](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice17.webp) ## Step 3: Create an Azure Automation Account 1. **Login to the Azure Portal**. 2. **Create an Automation Account** - Navigate to **Automation Accounts** and click **Add**. ![Clicking Add on the Automation Accounts page](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice18.webp) - Choose your resource group. ![Choosing the resource group for the automation account](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice19.webp) - Name the Automation account: **agentinstallation**. ![Naming the automation account agentinstallation](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice20.webp) - In the Advanced tab, **Select System Managed Identity**. ![Selecting System Managed Identity in the Advanced tab](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice21.webp) - Review your settings and click **Create**. ![Reviewing automation account settings before clicking Create](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice22.webp) 3. **Enable System Managed Identity** - Once the deployment completes, click **Go to resource**. ![Automation account deployment complete, with the Go to resource option](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice23.webp) - Search for **Identity** and toggle **System Managed Identity** to **On**. ![Toggling System Managed Identity to On under Identity](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice25.webp) 4. **Assign Roles** - Click **Azure role assignments** and use **Add role assignment** to assign the following roles: ![Opening Azure role assignments to add role assignments](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice25.webp) - **Role 1**: - Scope: Resource group - Subscription: Your target subscription - Role: Virtual Machine Contributor ![Assigning the Virtual Machine Contributor role scoped to the resource group](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice26.webp) - **Role 2**: - Scope: Storage - Subscription: Your target subscription - Resource: ecagentbinary - Role: Storage Blob Data Contributor ![Assigning the Storage Blob Data Contributor role on the ecagentbinary storage account](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice27.webp) - Wait a few minutes to verify that the roles are assigned. ![Verifying that the roles have been assigned](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice28.webp) ## Step 4: Create a New Runbook 1. **Go to the Automation Account** and select **Runbooks**. ![Selecting Runbooks in the automation account](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice29.webp) 2. Click **Create a runbook** and fill in the details: - Name: **agentinstallation** - Runbook type: **PowerShell** - Runtime version: **5.1** - Click **Review + Create**. ![Entering runbook details — name, PowerShell type, and runtime version 5.1](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice30.webp) ![Reviewing the runbook details before creating](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice31.webp) 3. **Edit the Runbook** - Download the [script](https://www.manageengine.com/products/desktop-central/scripts/runbookscript.ps1) below and copy the link and paste it into the editor. ![Pasting the downloaded script into the runbook editor](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice32.webp) ![The runbook script in the editor](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice33.webp) - Save and publish the runbook. ![Saving and publishing the runbook](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice34.webp) ![Confirmation that the runbook has been published](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice35.webp) 4. **Start the Runbook** - Wait for the deployment to finish, then click **Start** once available. - Open the **Jobs** tab to monitor the status and check the output tab for execution results. ![Starting the runbook and monitoring job status in the Jobs tab](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice36.webp) ## Troubleshooting In case of errors during script execution, ensure that the following two modules are imported in the **Modules** tab of the Automation account: Run time 5.1 - `az.accounts` ![Importing the az.accounts module in the Modules tab](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice37.webp) - `az.compute` ![Importing the az.compute module in the Modules tab](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/azureautomationservice38.webp) ## Conclusion By following this guide, you have successfully set up Azure Automation for agent installation. This setup streamlines the process of deploying agents across your Azure environment, allowing for greater efficiency and easier management. If you encounter any issues or have questions, don't hesitate to seek further assistance.