imlinhanchao/vsc-markdown-image

Support for Azure Blob storage

Closed this issue · 16 comments

Does your solution support Azure Blob Storage?

I have not used Azure Blob Storage. It appears to be the s3 protocol? You can try using s3 configuration.

S3 does not work. Blob storage has a connection string. I will contribute 25 USD if you can add blob storage. If you can make that 2 different blob storages can be used in 1 visual studio project I will donate 25 USD more. I am working on documentation on 2 different repositories and the images should go to 2 different storage accounts/ blobs.

Preferred Entra ID authorization with MFA so I can manage access in Azure portal on users level.
https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-dotnet-get-started?tabs=azure-ad#authorize-access-and-connect-to-blob-storage

Thanks. I will try it. But I am on vacation because it is the Chinese New Year in my country. I maybe won't do it soon.

Enjoy! Have had software company 25 years ago in Hangzhou and Beijing.

It's support Azure Blob Storage now. Please update to version 1.1.37 to use it.

Regarding your second request: to upload to two different repositories simultaneously, the current overall architecture cannot be configured to allow uploads to two different repositories.

However, you can achieve parallel uploads using the DIY mode. Save the following code as a file, set the file path in markdown-image.DIY.path, and add DIY as an upload method in markdown-image.base.uploadMethods. This will enable simultaneous uploads to two different repositories.

const { BlobServiceClient } = require("@azure/storage-blob");

const config = {
  connectionString: "other connect string",
  container: "other container"
};

module.exports = async function (filePath, savePath, markdownPath) {
  const blobServiceClient = BlobServiceClient.fromConnectionString(
    config.connectionString
  );

  const containerClient = blobServiceClient.getContainerClient(config.container);
  const blockBlobClient = containerClient.getBlockBlobClient(savePath);
  await blockBlobClient.uploadFile(filePath);

  return blockBlobClient.url;
}

Thank you. I am trying to use, but get this error:

Upload File Failed: Unable to extract accountName with provided information.

I only need to add https://.blob.core.windows.net

and my blob name

And turn Entra ID identification on?

Regarding your second request: to upload to two different repositories simultaneously, the current overall architecture cannot be configured to allow uploads to two different repositories.

I have multiple repositories I am working on from 1 work space. So I have different repositories for docs, docs-technical, docs-internal. The docs are for customers, the docs-technical for the technical persons and the docs-internal for internal use. The repositories do not have images. Those are uploaded to the respective repositories so also access on the images is limited per user group.

I can open of course a Visual Studio for every repository but not sure if that would work. It is much comfortable to have all together to work on:
image

Thank you. I am trying to use, but get this error:

Upload File Failed: Unable to extract accountName with provided information.

I only need to add https://.blob.core.windows.net

and my blob name

And turn Entra ID identification on?

Is the connect string from here ?
https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs?tabs=connection-string%2Croles-azure-portal%2Csign-in-azure-cli#authenticate-to-azure-and-authorize-access-to-blob-data

image

Regarding your second request: to upload to two different repositories simultaneously, the current overall architecture cannot be configured to allow uploads to two different repositories.

I have multiple repositories I am working on from 1 work space. So I have different repositories for docs, docs-technical, docs-internal. The docs are for customers, the docs-technical for the technical persons and the docs-internal for internal use. The repositories do not have images. Those are uploaded to the respective repositories so also access on the images is limited per user group.

I can open of course a Visual Studio for every repository but not sure if that would work. It is much comfortable to have all together to work on: image

Oh, I misunderstood your requirement. I thought you wanted to upload to two different blobs simultaneously. In reality, you want to upload MD files from different folders to different blobs.

To achieve this, you can indeed configure it by having different settings.json files within different .vscode directories. If you prefer to have only one instance of vscode open, you can create a new workspace and add different folders to it. Then, within each folder, use a different settings.json file for configuration.

Thank you for the quick reply. Happy New Year, I forgot.

I will try with different directories. Is it difficult to change/ add the Entra Id access on personal user flow instead of a shared key? The key is shared between users which I do not like. Their own account with MFA would be better.

With access key works by the way! I will look into the .vscode setup later.

Payment done.

Thank you for the quick reply. Happy New Year, I forgot.

I will try with different directories. Is it difficult to change/ add the Entra Id access on personal user flow instead of a shared key? The key is shared between users which I do not like. Their own account with MFA would be better.

Entra Id need to execute az login to login . So I don't support it at first. I will try to be compatible with both authentication methods.

It‘s support Passwordless authentication method now. You can have a try.

I have rotated the access key. Disabled the usage and allowed anonymous read access. Works as a charm! You are the BEST! Thank you.