Deleting A Logic App Without Log Analytics Configured?  Export Run Details For Preservation And Analysis with PowerShell

Deleting A Logic App Without Log Analytics Configured? Export Run Details For Preservation And Analysis with PowerShell

Sometimes, companies face the need to delete important Logic Apps but need to retain detailed information about their runs. Especially when Log Analytics isn’t configured, maintaining a record of past executions for auditing, analysis, storage, or compliance purposes is vital.

This script automates the process of fetching all the runs from a specified Logic App, extracting relevant details, and exporting them to .json files for further analysis or record-keeping purposes.

This PowerShell script offers several advantages in scenarios where users contemplate deleting a Logic App or encounter constraints due to the absence of Log Analytics configuration:

Mitigating Data Loss: Deleting a Logic App removes its associated history, potentially erasing valuable insights into past executions. By utilizing the PowerShell script, users can export run details to preserve crucial data before proceeding with deletion. In regulated environments or for auditing purposes, maintaining records of Logic App runs is essential. The script facilitates the preservation of run details, ensuring compliance with regulatory requirements and enabling comprehensive auditing.

Flexibility in Run Export: In scenarios where Log Analytics isn’t configured or accessible, the script offers an independent solution for exporting Logic App run details. Users aren’t bound by the constraints of Log Analytics and can seamlessly extract data for analysis or archival purposes. The script provides flexibility in defining the output directory and file format, empowering users to tailor the export process according to their specific requirements.

Automation and Efficiency: Rather than manually extracting run details one by one, the script automates the process, enabling batch processing of Logic App runs. This significantly reduces the time and effort required to export large volumes of data, enhancing operational efficiency. Users can schedule the execution of the PowerShell script to run at predefined intervals, ensuring regular and systematic export of Logic App run details.

This is an example of the result of using this PowerShell.

{
    "Run Details": {
        "properties": {
            "waitEndTime": "2024-03-01T07:10:28.9188779Z",
                       "startTime":  "2024-03-01T07:10:28.9188779Z",
                       "endTime":  "2024-03-01T07:14:01.1365889Z",
                       "status":  "Failed",
                       "code":  "ActionFailed",
                       "error":  {
                                     "code":  "ActionFailed",
                                     "message":  "An action failed. No dependent actions succeeded."
                                 },
                       "correlation":  {
                                           "clientTrackingId":  "08584923298565597836003987229CU207"
                                       },
                       "workflow":  {
                                        "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/versions/xxxxxxxxxxxxxx",
                                        "name":  "xxxxxxxxxxxxxx",
                                        "type":  "Microsoft.Logic/workflows/versions"
                                    },
                       "trigger":  {
                                       "name":  "manual",
                                       "inputsLink":  {
                                                          "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/contents/TriggerInputs?api-version=2016-06-01u0026se=2024-04-04T18%3A00%3A00.0000000Zu0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Fcontents%2FTriggerInputs%2Freadu0026sv=1.0u0026sig=0oO052pLkmJpj7DAepYpoYQPrTXnD17eABMoI_SuNpQ",
                                                          "contentVersion":  "SeXxiBX729iPh16dStbKtQ==",
                                                          "contentSize":  39,
                                                          "contentHash":  {
                                                                              "algorithm":  "md5",
                                                                              "value":  "SeXxiBX729iPh16dStbKtQ=="
                                                                          }
                                                      },
                                       "outputsLink":  {
                                                           "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/contents/TriggerOutputs?api-version=2016-06-01u0026se=2024-04-04T18%3A00%3A00.0000000Zu0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Fcontents%2FTriggerOutputs%2Freadu0026sv=1.0u0026sig=xsKG2tc7jdxJJqo9A3W_MD0mIrGtpskbDcSseRqE-v0",
                                                           "contentVersion":  "a+Tspez2SVAZ9sIcPBAGSg==",
                                                           "contentSize":  1319,
                                                           "contentHash":  {
                                                                               "algorithm":  "md5",
                                                                               "value":  "a+Tspez2SVAZ9sIcPBAGSg=="
                                                                           }
                                                       },
                                       "startTime":  "2024-03-01T07:10:28.9171171Z",
                                       "endTime":  "2024-03-01T07:10:28.9171171Z",
                                       "originHistoryName":  "08584923298565597836003987229CU207",
                                       "correlation":  {
                                                           "clientTrackingId":  "08584923298565597836003987229CU207"
                                                       },
                                       "status":  "Succeeded"
                                   },
                       "outputs":  {

                                   },
                       "response":  {
                                        "startTime":  "2024-03-01T07:10:28.9171171Z",
                                        "endTime":  "2024-03-01T07:12:28.9171171Z",
                                        "correlation":  {

                                                        },
                                        "code":  "ClientClosedRequest",
                                        "status":  "TimedOut",
                                        "error":  {
                                                      "code":  "ClientClosedRequest",
                                                      "message":  "The connection has been closed by the client while the server is still processing its request. Request tracking id u002708584923298565597836003987229CU207u0027."
                                                  }
                                    }
                   },
    "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207",
    "name":  "08584923298565597836003987229CU207",
    "type":  "Microsoft.Logic/workflows/runs"
}, 

"Actions":
{
    "value":  [
                  {
                      "properties":  {
                                         "inputsLink":  {
                                                            "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/actions/Condition/contents/ActionInputs?api-version=2016-10-01u0026se=2024-04-04T18%3A00%3A00.0000000Zu0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Factions%2FCondition%2Fcontents%2FActionInputs%2Freadu0026sv=1.0u0026sig=lUJRBMXTZXK2X-J-niWqKjK1jhKKMOy0gZW7pDZb_Io",
                                                            "contentVersion":  "VcJgxcEyXSxFSBf+CO4IaA==",
                                                            "contentSize":  25,
                                                            "contentHash":  {
                                                                                "algorithm":  "md5",
                                                                                "value":  "VcJgxcEyXSxFSBf+CO4IaA=="
                                                                            }
                                                        },
                                         "canResubmit":  true,
                                         "startTime":  "2024-03-01T07:13:56.8438876Z",
                                         "endTime":  "2024-03-01T07:13:58.3232409Z",
                                         "correlation":  {
                                                             "actionTrackingId":  "50e86726-67da-4a2b-b64d-63ee0b06a7ca",
                                                             "clientTrackingId":  "08584923298565597836003987229CU207"
                                                         },
                                         "status":  "Failed",
                                         "code":  "ActionFailed",
                                         "error":  {
                                                       "code":  "ActionFailed",
                                                       "message":  "An action failed. No dependent actions succeeded."
                                                   }
                                     },
                      "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207/actions/Condition",
                      "name":  "Condition",
                      "type":  "Microsoft.Logic/workflows/runs/actions"
                  },
                  {
                      "properties":  {
                                         "inputsLink":  {
                                                            "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/actions/Initialize_variable_Method/contents/ActionInputs?api-version=2016-10-01u0026se=2024-04-04T18%3A00%3A00.0000000Zu0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Factions%2FInitialize_variable_Method%2Fcontents%2FActionInputs%2Freadu0026sv=1.0u0026sig=ki-pG3ElkmY3GGO7XDykUK1_SwP3flJGMicWVwjFEeo",
                                                            "contentVersion":  "8LQjqFxi1kn06CVWRblTBQ==",
                                                            "contentSize":  64,
                                                            "contentHash":  {
                                                                                "algorithm":  "md5",
                                                                                "value":  "8LQjqFxi1kn06CVWRblTBQ=="
                                                                            }
                                                        },
                                         "canResubmit":  true,
                                         "startTime":  "2024-03-01T07:13:54.0050718Z",
                                         "endTime":  "2024-03-01T07:13:54.3965547Z",
                                         "correlation":  {
                                                             "actionTrackingId":  "dd0a7493-9cea-457e-bbbf-22b9cda43607",
                                                             "clientTrackingId":  "08584923298565597836003987229CU207"
                                                         },
                                         "status":  "Succeeded",
                                         "code":  "NotSpecified"
                                     },
                      "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207/actions/Initialize_variable_Method",
                      "name":  "Initialize_variable_Method",
                      "type":  "Microsoft.Logic/workflows/runs/actions"
                  },
                  {
                      "properties":  {
                                         "inputsLink":  {
                                                            "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/actions/Initialize_variable_Querie_RelativePath/contents/ActionInputs?api-version=2016-10-01u0026se=2024-04-04T18%3A00%3A00.0000000Zu0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Factions%2FInitialize_variable_Querie_RelativePath%2Fcontents%2FActionInputs%2Freadu0026sv=1.0u0026sig=t7EIY1rFWIZ91Scqyr3_e2LltC5vARtXqjt_cyuzsr4",
                                                            "contentVersion":  "LuEj19cQMUxIjDnr48BRjg==",
                                                            "contentSize":  76,
                                                            "contentHash":  {
                                                                                "algorithm":  "md5",
                                                                                "value":  "LuEj19cQMUxIjDnr48BRjg=="
                                                                            }
                                                        },
                                         "canResubmit":  true,
                                         "startTime":  "2024-03-01T07:13:56.1452411Z",
                                         "endTime":  "2024-03-01T07:13:56.1611035Z",
                                         "correlation":  {
                                                             "actionTrackingId":  "07028bc6-925d-4c7c-8f26-6bf52b4459df",
                                                             "clientTrackingId":  "08584923298565597836003987229CU207"
                                                         },
                                         "status":  "Succeeded",
                                         "code":  "NotSpecified"
                                     },
                      "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207/actions/Initialize_variable_Querie_RelativePath",
                      "name":  "Initialize_variable_Querie_RelativePath",
                      "type":  "Microsoft.Logic/workflows/runs/actions"
                  },
                  {
                      "properties":  {
                                         "inputsLink":  {
                                                            "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/actions/Initialize_variable_RelativePath/contents/ActionInputs?api-version=2016-10-01u0026se=2024-04-04T18%3A00%3A00.0000000Zu0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Factions%2FInitialize_variable_RelativePath%2Fcontents%2FActionInputs%2Freadu0026sv=1.0u0026sig=FN5vPoxPPtXqwUTawZWCCoDD577FBcyISw4b7AsP8k4",
                                                            "contentVersion":  "W0eIKtVYxtDOxh5MrNmeCg==",
                                                            "contentSize":  70,
                                                            "contentHash":  {
                                                                                "algorithm":  "md5",
                                                                                "value":  "W0eIKtVYxtDOxh5MrNmeCg=="
                                                                            }
                                                        },
                                         "canResubmit":  true,
                                         "startTime":  "2024-03-01T07:13:55.433751Z",
                                         "endTime":  "2024-03-01T07:13:55.4482694Z",
                                         "correlation":  {
                                                             "actionTrackingId":  "994cc832-833a-445f-b784-1a9a1c85d9d3",
                                                             "clientTrackingId":  "08584923298565597836003987229CU207"
                                                         },
                                         "status":  "Succeeded",
                                         "code":  "NotSpecified"
                                     },
                      "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207/actions/Initialize_variable_RelativePath",
                      "name":  "Initialize_variable_RelativePath",
                      "type":  "Microsoft.Logic/workflows/runs/actions"
                  },
                  {
                      "properties":  {
                                         "inputsLink":  {
                                                            "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/actions/Response/contents/ActionInputs?api-version=2016-10-01u0026se=2024-04-04T18%3A00%3A00.0000000Zu0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Factions%2FResponse%2Fcontents%2FActionInputs%2Freadu0026sv=1.0u0026sig=xy7As_2c_drwERNraivg3QTjWkVMm0JiF-EVcF9L6F4",
                                                            "contentVersion":  "pfCJnfA/DmQvDHCg1asiDA==",
                                                            "contentSize":  80,
                                                            "contentHash":  {
                                                                                "algorithm":  "md5",
                                                                                "value":  "pfCJnfA/DmQvDHCg1asiDA=="
                                                                            }
                                                        },
                                         "canResubmit":  true,
                                         "startTime":  "2024-03-01T07:13:57.6536825Z",
                                         "endTime":  "2024-03-01T07:13:57.6548866Z",
                                         "correlation":  {
                                                             "actionTrackingId":  "a8b35cc0-bc78-4fc8-8350-3f14e1fe8bac",
                                                             "clientTrackingId":  "08584923298565597836003987229CU207"
                                                         },
                                         "status":  "Failed",
                                         "code":  "ActionResponseTimedOut",
                                         "error":  {
                                                       "code":  "ActionResponseTimedOut",
                                                       "message":  "The execution of template action u0027Responseu0027 is failed: the client application timed out waiting for a response from service. This means that workflow took longer to respond than the alloted timeout value. The connection maintained between the client application and service will be closed and client application will get an HTTP status code 504 Gateway Timeout."
                                                   }
                                     },
                      "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207/actions/Response",
                      "name":  "Response",
                      "type":  "Microsoft.Logic/workflows/runs/actions"
                  }
        ]
    }
}

Here, we highlighted the most important information, which can be key when you need to understand what happened during the execution of this Logic App.

Using this PowerShell script requires entering your Resource Group, Logic App Name, and the directory where you want to export the run records, which will be saved as .json files. You will be prompted to input your credentials since the PowerShell uses the command Connect-AzAccount.

Upon completion, your exported results will resemble the provided example. Examining the generated files allows easy identification of the Logic App and provides insight into whether the runs succeeded or failed.

If you only wish to export and retain failed runs, you can utilize a similar PowerShell script:

I hope this can help you in the future.

Hope you find this helpful! If you enjoyed the content or found it useful and wish to support our efforts to create more, you can contribute towards purchasing a Star Wars Lego for Sandro’s son!

Friday Fact: Azure Logic Apps Supports Both Dot and Bracket Notations

Friday Fact: Azure Logic Apps Supports Both Dot and Bracket Notations

Azure Logic Apps offer flexibility in how you access data from JSON inputs, supporting both dot and bracket notations

Azure Logic Apps offers a flexible and first-class experience for you to access data within JSON structures. The most common way to access it is using tokens when you tokenize a message using a JSON schema or by using bracket notations. In fact, tokens use behind-the-scene bracket notations to reference those values. But do you know that there is another way? Another convention?

Consider we receive the following JSON input in a Logic App through a When a HTTP Request is received trigger:

{
    "ID": {
        "name": "Luis",
        "lastName": "Rigueira",
        "age": 34
    }
}

The approach to access the name using the bracket notation would be using the expression:

triggerBody()?['ID']?['name']

In a Logic Apps context:

Now, what a lot of people don’t know, and what isn’t very common to see, is that Logic Apps also supports Dot notation. Taking the sample above, accessing the same field can be achieved in Dot notation like this:

triggerBody().ID.name

In a Logic Apps context:

As you can see both methods return the same output.

The dot notation feels more natural and readable, so why do we not use it more often?

Dot notation is notably more streamlined and mirrors the property access seen in programming languages like JavaScript, enhancing readability. Bracket notation, however, brings a level of versatility to the table.

While both notations are valid and can be used interchangeably in many cases, bracket notation has the upper hand when it comes to accessing properties with dynamic names or names that include special characters, which dot notation can’t handle.

Dot Notation: Known for its simplicity and readability, dot notation is straightforward. It allows you to access the properties of a JSON object directly by their names. For instance, triggerBody().ID.name effortlessly fetches the name property from the trigger body of a Logic App that receives the previous input. This notation shines in its clarity, making code easier to read and understand at a glance.

Bracket Notation: Bracket notation, on the other hand, provides a level of flexibility unmatched by dot notation. It allows for the dynamic access of properties and the handling of property names that contain special characters or spaces.

Let’s take this JSON as an example:

{
  "user-info": {
    "first-name": "John",
    "last-name": "Doe"
  }
}

Here the bracket notation, (triggerBody()[‘user-info’][‘first-name’]) accesses properties that would be inaccessible with dot notation due to the presence of hyphens. This method is indispensable when dealing with dynamic property names or JSON objects with complex structures.

And, in case you were wondering, yes you can combine both methods together!

triggerBody().ID['name']

In conclusion, while Azure Logic Apps support both dot and bracket notations for accessing JSON properties, each notation has its strengths and best use cases.

Ultimately, the choice between dot and bracket notation depends on the specific requirements of your Logic App and the nature of the JSON data you’re working with. By understanding the strengths of each notation, you can leverage them effectively to build robust and adaptable Logic Apps tailored to your needs.

To lazy to read? We’ve got you covered! Check out our video version of this content!

Hope you find this helpful! If you enjoyed the content or found it useful and wish to support our efforts to create more, you can contribute towards purchasing a Star Wars Lego for my son!

Seamlessly Adding Tags to Azure Function Apps via Visual Studio: A Guide for Enhanced Resource Management

Seamlessly Adding Tags to Azure Function Apps via Visual Studio: A Guide for Enhanced Resource Management

Have you ever wondered how to add tags to your Function App through Visual Studio?

Let’s break it down, but first, here’s a quick overview of how you would do it in the Azure Portal:

  • On your Function App overview page, under the Essentials information on the left, you’ll find “Tags” with an “Edit” button next to it.
  • Clicking on it allows you to add new tags to your function app. These tags essentially function as meta tags, consisting of key and value pairs, such as Name and Value.

But why do I need tags? You might be wondering.

Overall, tags offer a flexible and customizable way to manage and govern resources in Azure, enabling better organization, cost management, monitoring, and governance across your environment.

  • Organization and Categorization: Tags allow you to categorize and organize resources based on different criteria, such as department, project, environment (e.g., production, development), or cost center. This makes it easier to locate and manage resources, especially in larger deployments with numerous resources.
  • Cost Management: Tags can be used for cost allocation and tracking. By assigning tags to resources, you can easily identify the costs associated with specific projects, teams, or departments. This helps in budgeting, forecasting, and optimizing resource usage to control costs effectively.
  • Monitoring and Reporting: Tags provide metadata that can be used for monitoring and reporting purposes. You can use tags to filter and aggregate data in monitoring tools, allowing you to gain insights into resource usage, performance, and operational trends across different categories.
  • Access Control and Governance: Tags can also be leveraged for access control and governance purposes. By tagging resources based on their sensitivity, compliance requirements, or ownership, you can enforce policies, permissions, and compliance standards more effectively.

Now that we already describe the importance of tags and how you can add them from the Azure Portal, let’s dive into it with Visual Studio:

  • After you’ve published your Azure Function, or if you’re working with an existing published one, head over to the Solution Explorer and right-click on your solution.
  • From there, go to Add -> New Project. Now, search for Azure Resource Group and give it a double click.
  • You’ll be prompted to name your project. You can leave the location as is since it’s the project you’re currently working on. Click on Create once you’re done.
  • Now, in the Solution Explorer, you’ll spot a new project. Inside, you’ll find two .json files:
    • azuredeploy.json
    • azuredeploy.parameters.json
  • The file we’re interested in is azuredeploy.json. Double-click on it and replace its content with the provided JSON. Don’t forget to customize it with the tags you need and also your Function App Name. For now, let’s use these tags for our proof of concept:
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "functionAppName": {
      "type": "string",
      "metadata": {
        "description": "Name of the Azure Function App"
      },
      "defaultValue": "YOUR-FUNCTION-APP-NAME"
    }
  },
  "resources": [
    {
      "type": "Microsoft.Web/sites",
      "apiVersion": "2020-12-01",
      "name": "[parameters('functionAppName')]",
      "location": "West Europe",
      "properties": {
        "siteConfig": {
          // Define site configuration properties here
        }
      },
      "tags": {
        "Environment": "POC",
        "Project": "PdfMerger",
        "Company": "DevScope",
        "Year": "2024"
      }
    }
  ],
  "outputs": {}
}
  • Back in the Solution Explorer, right-click on the project you’ve just created and select Deploy -> New.
  • You’ll then need to choose your subscription and resource group. Finally, hit Deploy.

Once the deployment finishes smoothly without any errors, it’s time to inspect your Function App. You’ll notice that all your tags are now displayed on the Function App overview page.

Adding tags to your function app through Visual Studio provides a streamlined way to organize, manage, and govern your resources in Azure by categorizing resources based on criteria such as environment, project, company, etc.

Tags facilitate easier navigation and management, particularly in complex deployments. Moreover, tags play a crucial role in cost allocation, monitoring, reporting, and access control, offering valuable insights and enhancing governance across your environment.

While both methods, Visual Studio and the Azure Portal, offer ways to manage tags for resources like function apps, for simple solutions that don’t require having multiple environments, there are certain advantages to using Visual Studio for this task:

  • Automation and Consistency: Visual Studio allows you to automate the deployment of resources along with their tags using Infrastructure as Code (IaC) principles. This ensures consistency across deployments and reduces the chance of human error compared to manually adding tags in the Azure Portal.
  • Version Control: When managing your Azure resources through Visual Studio, you can maintain version control over your infrastructure code. This means you can track changes to your tags along with other resource configurations, making it easier to revert to previous versions if needed.
  • Integration with Development Workflow: For teams that primarily work within Visual Studio for development tasks, integrating tag management into the development workflow streamlines processes. Developers can manage both code and resource configurations in a unified environment, enhancing collaboration and efficiency.
  • Scalability: Visual Studio is well-suited for managing tags across multiple resources or environments. With the ability to define and deploy resource templates containing tags programmatically, scaling tag management becomes more manageable, especially in large-scale deployments.
  • Consolidated Management: Using Visual Studio for tag management allows you to centralize the configuration of tags alongside other resource settings. This consolidated approach simplifies overall resource management, providing a single interface for configuring and deploying resources and their associated tags.

It is important to note that the choice between Visual Studio and the Azure Portal ultimately depends on your specific requirements, preferences, and existing workflows. While Visual Studio offers certain advantages for tag management, the Azure Portal provides a user-friendly interface that may be more accessible for simple or ad-hoc tag assignments. This way, organizations should evaluate their needs and capabilities to find the most suitable approach for managing tags in their Azure environment.

Of course, in the end, the best solution is to use CI/CD pipelines to accomplish this task.

Hope you find this helpful! If you enjoyed the content or found it useful and wish to support our efforts to create more, you can contribute towards purchasing a Star Wars Lego for Sandro’s son!

Friday Fact: Settings present on local.settings.json file inside Azure Functions project are not deployed with Visual Studio

Friday Fact: Settings present on local.settings.json file inside Azure Functions project are not deployed with Visual Studio

When creating an Azure Function, it’s crucial for security reasons to avoid directly embedding connection strings and other sensitive information in the code.

In our development environment, a common best practice is to store such important information in the local.settings.json file:

This image has an empty alt attribute; its file name is Screenshot_1563.png

Of course, we can improve even more by also binding Key Vault. If your local tests go as expected and the code is correct, the next step you will have is to deploy it into your Azure Subscription. This brings us to today’s Friday Fact!

However, once you upload the Azure Function to the Function App in the Azure Portal and attempt to use it, for example, in a Logic App, you may notice a discrepancy between the local test and the Logic App environment. The challenge doesn’t lie in integrating the Azure Function into a Logic App but rather in the loss of configurations.

Here’s the catch: the local.settings.json file doesn’t get deployed directly with Visual Studio (manual deployment) in a way that carries along your connection strings and other critical information. As a result, you’ll need to configure these details after deployment in the Function App, ensuring they match the key-value pairs from your local.settings.json file. – Of course, if you implement CI/CD, this can easily be accomplished inside DevOps pipelines!

Once this configuration step is complete, your Azure Function and the flow within the Logic App should run smoothly. It’s essential to be mindful of this potential loss of configuration, as overlooking it can lead to issues like attempting to troubleshoot the Azure Function locally and deploying without success.

Within the Function App, you can smoothly configure sensitive information by navigating to the Environment Variables section under Settings in the left menu.

This is the key spot where you can input the necessary details, ensuring a seamless operation for your Azure Function. By managing these environment variables effectively, you’ll have your Azure Function up and running.

Hope you have enjoyed this Friday Fact, and we will see you in the next one!

To lazy to read? We’ve got you covered! Check out our video version of this content!

Hope you find this helpful! So, if you liked the content or found it useful and want to help me write more, you can help us buy a Star Wars Lego for Sandro’s son!