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. Currently I just have the connection string to the container hard coded within my function. However the issue is, the file needs to be uploaded to a different container depending whether the dev or prod deployment of the function is being used.
var connectionString = "sampleConnectionString";
BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
var containerNameXML = "sampleContainerName";
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerNameXML);
BlobClient blobClient = containerClient.GetBlobClient(xmlFileName);
I know I can store the connection string in a local.settings.json file and access it in the code, but that would only be for one of the environments. So I am wondering if it is possible to overwrite the local environment variable via azure for each environment or something similar.
Thank you in advance for any advice.
CodePudding user response:
You can change settings in Azure for your functions app.