Automation runbook for start/stop VM using Storage account blob

WinTechie 286 Reputation points
2024-07-17T06:57:19.4766667+00:00

Hi,

I am trying to deploy a powershell runbook in automation account which should read contents of CSV stored in storage account blob using system assigned managed identity of automation account.

Looking for a piece of code as I don't want to use sas token or access key of storage account in the runbook to read blob contents

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,221 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,257 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,582 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Nehruji R 8,146 Reputation points Microsoft Vendor
    2024-07-18T07:57:27.66+00:00

    Hello WinTechie,

    Greetings! Welcome to Microsoft Q&A Platform.

    I understand that you would like to about a PowerShell script for your runbook that uses the system-assigned managed identity of your Azure Automation account to read the contents of a CSV file stored in a blob storage account.There are a number of ways that you can run it in Azure and one of the easiest ways would be to run it in Azure Automation which would not require having a machine to be in running state. I have provided a following docs required to create a simple runbook and run it in Azure below:

    This article 1, article 2 shows you how to enable a managed identity for an Azure Automation account and how to use it to access other resources. For more information on how managed identities work with Azure Automation, see Managed identities.

    If you want, you can also attach schedule to this runbook, so that it will be run regularly based on it.

    Similar threads for reference - https://stackoverflow.com/questions/75744604/azure-automation-powershell-runbook-to-get-vm-details-in-csv-file-and-export-tha,https://stackoverflow.com/questions/76436246/how-to-import-csv-file-data-in-azure-blob-into-a-variable-in-powershell-using-po, https://stackoverflow.com/questions/74861660/how-to-connect-with-storage-account-in-azure-automation-runbook.

    Hope this information helps! please let us know if you have any further queries. I’m happy to assist you further.


    Please "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.