I basically want to use UseDevelopmentStorage=true but with the new way of providing credentials using StorageSharedKeyCredential i only can share account name and key.
Example:
// Use StorageSharedKeyCredential with storage account and account key
// StorageSharedKeyCredential is only avaiable in Node.js runtime, not in browsers
const sharedKeyCredential = new StorageSharedKeyCredential(accountName, accountKey);
So where i'm supposed to use UseDevelopmentStorage=true?
The docs around the library are not clear enough and don't match all of the basic use cases!
@ahmedspiir For BlobServiceClient you can use the static function fromConnectionString().
For other clients there are constructor overload that takes a connection string, for example, ContainerClient has
/**
*
* Creates an instance of BlobClient from connection string.
*
* @param {string} connectionString Account connection string or a SAS connection string of an Azure storage account.
* [ Note - Account connection string can only be used in NODE.JS runtime. ]
* Account connection string example -
* `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`
* SAS connection string example -
* `BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`
* @param {string} containerName Container name.
* @param {string} blobName Blob name.
* @param {StoragePipelineOptions} [options] Optional. Options to configure the HTTP pipeline.
* @memberof BlobClient
*/
constructor(
connectionString: string,
containerName: string,
blobName: string,
options?: StoragePipelineOptions
);
https://github.com/azure/azure-sdk-for-js/blob/master/sdk/storage/storage-blob/src/Clients.ts#L857-L877
Please let us know if the above doesn't work for you.
Thanks @jeremymeng, i tried BlobServiceClient.fromConnectionString and it worked.
Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.
Most helpful comment
@ahmedspiir For
BlobServiceClientyou can use the static functionfromConnectionString().For other clients there are constructor overload that takes a connection string, for example,
ContainerClienthashttps://github.com/azure/azure-sdk-for-js/blob/master/sdk/storage/storage-blob/src/Clients.ts#L857-L877
Please let us know if the above doesn't work for you.