Search code examples
azureazure-storageazure-devops-server-2019

ADS 2019: How to create a service connection to an Azure Storage Emulator?


As a part of my testing harness, I'd like to deploy to an Azure Storage Emulator container.

For production releases, I'll use an Azure CLI release task with this command:

call az storage blob sync -s %ReleaseDirectory% -c %ReleaseName% --account-name %AccountName%

This works fine.

The trouble starts when I attempt to create a service connection to the emulator for my testing environment. For creating such a connection, we get this dialog:

Add a service connection

See the problem? Subscription ID... Tenant ID... SPN info... none of these exist for an emulator instance. Apparently we can only create a connection to a full-blown Azure Storage account. There doesn't seem to be provision for connecting to an emulator.

Is there another way? How can I create a service connection to an Azure Storage Emulator so that I can use it in Azure-related pipeline tasks?


Solution

  • There is not a service connection for Azure Storage Emulator in azure devops. Above screenshot is the service connection for azure resources on cloud.

    If Azure Storage Emulator is installed on local machine, The cloud agents will not able to access to the Azure Storage Emulator hosted on your local machine. You will have to create a self-hosted agent(on the same local machine). And run your pipeline on the self-hosted agent. So that your pipeline can access to the Azure Storage Emulator.

    Follow the steps here to create a self-hosted agent.

    If the Azure Storage Emulator and your self-hosted agent are installed on different machines. You can add a SSH service connection to connect to the machine which hosts the Azure Storage Emulator. Then you can use SSH task or PowerShell on Target Machines task to run scripts on the remote machines.

    If the Azure Storage Emulator container is hosted on Azure Container Registry. You can add Docker Registry service connection. So that you can use Docker task to run the Azure Storage Emulator container on the agent machine. See below:

    enter image description here