![](/img/trans.png)
[英]Azure storage blobs, C#, how can I determine what blob is currently in use?
[英]Can use a different blob storage connection string in my azure function (c#) depending if I am in dev or prod?
I built an azure function that gets an XML file from a POST request, converts it to JSON and uploads it to an azure blob storage container. 目前,我的 function 中只有硬编码到容器的连接字符串。 但是问题是,需要将文件上传到不同的容器,具体取决于使用的是 function 的 dev 还是 prod 部署。
var connectionString = "sampleConnectionString";
BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
var containerNameXML = "sampleContainerName";
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerNameXML);
BlobClient blobClient = containerClient.GetBlobClient(xmlFileName);
我知道我可以将连接字符串存储在 local.settings.json 文件中并在代码中访问它,但这仅适用于其中一种环境。 所以我想知道是否可以通过 azure 为每个环境或类似的东西覆盖本地环境变量。
提前感谢您的任何建议。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.