:::: MENU ::::
Browsing posts in: DevOps

Print all environment variables in Azure DevOps for Windows Agents with Powershell

If you are looking how to achieve the same goal with Linux agents and Bash see Print all environment variables in Azure DevOps for Linux Agents with Bash.

OK, so I had a problem with trying to figure out which variables are available for me and what are their values – Microsoft documentation is not always that helpful on that. As inspired by Mohit Goyal post I would like to share the same idea – on how to debug all the available variables but this time on those machines where you don’t have bash but powershell instead.

Just add to your pipeline PowerShell task, switch to inline script and fill the script

Get-ChildItem -Path Env:\ | Format-List

so it looks like

and after creation of a new release pipeline and execution of this pipeline you should have something like this:

Find blocked requests by Azure WAF in Log Analytics

Assuming that you have correctly connected Azure WAF to Log Analytics you can run a simple query to list all the requests that have been blocked by WAF

| where ResourceType == "FRONTDOORS" and Category == "FrontdoorWebApplicationFirewallLog"
| where action_s =~ "block"
| order by TimeGenerated desc 

Collecting IP addresses in Azure App Insights

When you want to collect IP addresses in Azure App Insights, you have to enable it. By default IP addresses are masked and you can only see some basic information like city or country.

If you want to enable this feature you can’t use Azure Portal, at least for now. The easiest way to do it, is to use Azure Resource Explorer.

  1. Go to https://resources.azure.com/ and pick proper AD you want to work with
  2. Click on Read/Write mode in top of the page.
  3. Find your App Insight instance by going into subscriptions / YOUR_SUBSCRIPTION / resourceGroups / YOUR_RESOURCE_GROUP / providers / microsoft.insights / components
  4. In Data tab click on Edit
  5. Remove the content of the properties property and put "DisableIpMasking": true
  6. Hit Patch button since we are changing the part of the resource definition.
  7. Done!

Example JSON payload

  "id": "/subscriptions/XXX/resourceGroups/XXX/providers/microsoft.insights/components/XXX",
  "name": "XXX",
  "type": "microsoft.insights/components",
  "location": "westeurope",
  "tags": {},
  "kind": "web",
  "etag": "\"XXX\"",
  "properties": {
    "DisableIpMasking": true

Also this part of a documentation may be useful https://docs.microsoft.com/en-us/azure/azure-monitor/app/ip-collection