upload file to Azure blob using powershell and SSIS VS2008 - generate key at run time

Supriya Gupta 21 Reputation points
2020-11-25T01:13:42.437+00:00

42381-2020-11-25-12-06-40.pngHI
I am trying to upload files to Azure Blob Storage. Below is the script i am using :

The script is working fine but the only problem is when i execute this script in powershell or VS2008 it takes me to web browser and asks me to select the account. I do not want that to happen , and connect to Azure Blob by getting the key at run time using subscriptionID. I do not want to hard-code the key in my code. Because i am using Connect-AzAccount and it is due to that i know it tasks me to select account in web browser. How do i connect using subscriptionID and getting key at run time only. Another thing i want to know is does the key change or remains constant always for a given subscriptionID?

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,415 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. deherman-MSFT 33,141 Reputation points Microsoft Employee
    2020-11-25T20:14:34.837+00:00

    @Supriya Gupta
    For non-interactive login you will need to use a service principal to login. See Create an Azure service principal with Azure PowerShell for information on how to create one. You can also assign an Azure role to the service principal for data access, this would allow you to upload data without using the key.

    Storage account keys do not change unless you rotate them. Please see Manage storage account access keys if you have further questions.

    -------------------------------

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