Wednesday, June 21, 2023

Apply Azure DevOps variable groups to Azure App Service deployment slot scope

In enterprise application development, we typically have multiple release environments such as Development (Dev), Testing (Test), User Acceptance Testing (UAT), Pre-Production (Pre-Prod), and Production. When deploying to these environments using CI/CD pipelines, we often need to transform variables to match the the target environment.

In Azure DevOps, we utilize variable groups to carry out the variable transformation process.

If we are utilizing Azure App Services with the deployment slot option enabled, it's essential to apply the configuration transformation for the slot as well.

How can we ensure that the deployment slot release stage has the transformed configurations?

Following are the steps we can use.

Navigate to release pipeline and click on the variables section










Then click on more options and select Change scope










Ensure your slot is selected



Friday, June 9, 2023

Queue triggered Azure Function - Take only one message from queue at a time

I encountered a situation where my queue-triggered function didn't consistently behave as expected. The issue stemmed from the function's execution order not aligning with my expectations.

The root cause of this problem lies in the unpredictability of message ingestion order within a storage queue when executing queue-triggered functions. While storage queues are designed to process messages in a first-in, first-out (FIFO) fashion, several factors can influence the actual order of message ingestion. For instance, when multiple instances of the function run concurrently, messages may be processed out of sequence. Furthermore, delays in message processing or variations in message priorities can also disrupt the expected order of ingestion.

If your objective is to maintain a strict order of message ingestion and you are utilizing a storage queue, you'll need to address this concern within your code. Alternatively, you can consider migrating to a more dependable solution, such as Azure Service Bus Queue, which offers greater control over message ordering.

However, if your problem can be resolved by dequeuing one message at a time, you can implement the following adjustments to your host.json file within your Azure Function App.


    "extensions": {
    "queues": {
      "batchSize": 1,
      "newBatchThreshold": 0,
      "maxDequeueCount": 1
    }
  }
  

This helped my application to function as expected.