azure-functionsazure-durable-functionsorchestrationazure-storage-emulator

Azure Durable Function - Change the port for Azure Storage Emulator


I was revising some concepts on Azure Durable function to become ready for a new project and facing an issues with Azure Storage emulator. The azure storage emulator uses the following ports:

<service name="Blob" url="http://127.0.0.1:10000/"/>
<service name="Queue" url="http://127.0.0.1:10001/"/>
<service name="Table" url="http://127.0.0.1:10002/"/>

The problem is that I cant use 10000-10002 because some other services are already running and I cant control it as they are controlled by admins. I was able to change the ports in AzureStorageEmulator.exe.config

<service name="Blob" url="http://127.0.0.1:10003/"/>
<service name="Queue" url="http://127.0.0.1:10004/"/>
<service name="Table" url="http://127.0.0.1:10005/"/>

The problem I face now is that my durable function still looks at 10000-10002 and fails. How can I change the ports for storage account emulator for my durable function.


Solution

  • You should be able to change the Storage connection string that you use locally to this form:

    DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;
    

    In there you can define the port numbers. The account name and key should work as those are the default ones for the emulator. Documentation: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio#connection-strings