Search code examples
visual-studioconfigurationazure-storageazure-storage-emulator

Configuring Development Storage Account in Server Explorer


I have changed the ports that Azure Storage Emulator runs on from 10000,10001,10002 to 10003,10004,10005 from the config file at "C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\WAStorageEmulator.exe.config"

Now when I try to access Development Storage from Server Explorer in Visual Studio 2013 it fails to access the updated ports. I tried to manually add external storage and specify the endpoints to reflect the updated ports with the following info default storage account information:

DefaultEndpointsProtocol=http

AccountName=devstoreaccount1

AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==

BlobEndpoint=http://127.0.0.1:10003/devstoreaccount1

QueueEndpoint=http://127.0.0.1:10004/devstoreaccount1

TableEndpoint=http://127.0.0.1:10005/devstoreaccount1

but that still does not allow it to connect. I also tried the same endpoints but without the storage account suffix. It even reverts the ports to 10000,10001,10002 when I refresh the External Storage. I assume it is reading from some config somewhere but I cannot seem to google any answer as to where this is being read from.

So how can I configure Server Explorer to reflect the updated ports?


Solution

  • The ports are hard coded into the CloudStorageAccount class so no you can't modifiy them:

     private static CloudStorageAccount GetDevelopmentStorageAccount(Uri proxyUri)
            {
                UriBuilder uriBuilder = proxyUri != (Uri)null ? new UriBuilder(proxyUri.Scheme, proxyUri.Host) : new UriBuilder("http", "127.0.0.1");
                uriBuilder.Path = "devstoreaccount1";
                uriBuilder.Port = 10000;
                Uri uri1 = uriBuilder.Uri;
                uriBuilder.Port = 10001;
                Uri uri2 = uriBuilder.Uri;
                uriBuilder.Port = 10002;
                Uri uri3 = uriBuilder.Uri;
                uriBuilder.Path = "devstoreaccount1-secondary";
                uriBuilder.Port = 10000;
                Uri uri4 = uriBuilder.Uri;
                uriBuilder.Port = 10001;
                Uri uri5 = uriBuilder.Uri;
                uriBuilder.Port = 10002;
                Uri uri6 = uriBuilder.Uri;
                CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(new StorageCredentials("devstoreaccount1", "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="), new StorageUri(uri1, uri4), new StorageUri(uri2, uri5), new StorageUri(uri3, uri6), (StorageUri)null);
                cloudStorageAccount.Settings = (IDictionary<string, string>)new Dictionary<string, string>();
                cloudStorageAccount.Settings.Add("UseDevelopmentStorage", "true");
                if (proxyUri != (Uri)null)
                    cloudStorageAccount.Settings.Add("DevelopmentStorageProxyUri", proxyUri.ToString());
                cloudStorageAccount.IsDevStoreAccount = true;
                return cloudStorageAccount;
            }