An Azure service that is used to automate, configure, and install updates across hybrid environments.
Hello Tyler Johnson. It sounds like you’re on the right track with wanting to automate your PowerShell script using Azure Automation, especially since you’re working with local files. Here's how you can set this up using a Hybrid Worker:
Steps to Create an Automated PowerShell Script with Azure Automation:
- Set up Azure Automation Account:
- Log into the Azure portal.
- Create an Azure Automation account by selecting Create a resource, then searching for Automation and following the prompts.
- Configure Hybrid Worker:
- Since your script uses a CSV file on your local drive, you will need to configure a Hybrid Worker. This allows Azure Automation to run scripts on your local machine.
- Follow the instructions in the Hybrid Runbook Worker.
- Create a Runbook:
- In your Azure Automation account, go to the Runbooks section and click Create a runbook.
- Choose a suitable name, set the type to "PowerShell", and click Create.
- Edit the Runbook:
- Paste your existing PowerShell code into the editor. Since it's looking for a CSV file on your local machine, ensure it's available to the Hybrid Worker:
import-Csv -Path "C:\Users\OneDrive - Documents\Power Automate Lists\Test.csv" | foreach{Add-DistributionGroupMember -Identity "Test2" -Member $_.Email}
- Paste your existing PowerShell code into the editor. Since it's looking for a CSV file on your local machine, ensure it's available to the Hybrid Worker:
- Test your Runbook:
- After editing, you can test your runbook from the Azure portal.
- Publish your Runbook:
- Once you are satisfied with the testing, publish the runbook to make it available for scheduling.
- Schedule the Runbook:
- You can schedule the runbook to run at specific intervals if needed.
Reference: Create a Hybrid Worker
Hope this helps! Let me know if you have any more questions!
If the provided answer was helpful, please click Accept the Answer and upvote if the above was helpful.
Thanks