-1

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?

InteXX
  • 6,135
  • 6
  • 43
  • 80

1 Answers1

1

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

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43
  • Just to clarify, I'm not using Azure DevOps Services. I'm using Azure DevOps Server 2019, as indicated in the tags. My build agent is running on the same machine. Does this change your answer? I'm unclear on your second paragraph—could you explain how to access the emulator from my ADS 2019 instance running on the same server. Thanks. – InteXX Jun 24 '20 at 09:52
  • You can check out [this link](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-emulator#connect-to-the-emulator-account-using-a-shortcut) to connect to azure storage emulator. Since your build agent is hosted on the same machine. It is just like how you connect to azure storage emulator locally. – Levi Lu-MSFT Jun 24 '20 at 10:08
  • Thanks for the link, but I'm not trying to connect from within my application. I'm trying to connect from an ADS Release Task, so I can upload my application for testing prior to release. Also, again, this is an on-premises ADS 2019 instance, not the cloud-based Azure DevOps Services. – InteXX Jun 24 '20 at 13:50
  • You can use az cli command, like `azcopy copy"C:\LocalDir" "http://://" --from-to LocalBlob` – Levi Lu-MSFT Jun 25 '20 at 09:52
  • OK. [It's working](https://stackoverflow.com/a/62586633), although I had to switch to Azurite and fall back to PowerShell to get here. Both AzureCLI and AzCopy have been significant disappointments when working under emulation. But it was your suggestion that started me down this path that ultimately worked, so thank you. – InteXX Jun 26 '20 at 02:09