![](/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.