Small, but very useful snippet:
import jsonpickle # pip install jsonpickle
import json
serialized = jsonpickle.encode(obj)
print(json.dumps(json.loads(serialized), indent=2))
Small, but very useful snippet:
import jsonpickle # pip install jsonpickle
import json
serialized = jsonpickle.encode(obj)
print(json.dumps(json.loads(serialized), indent=2))
Often I have to make sure how I am visible to the world – what is my IP address that some service will see. I’ve found a great tool for that – ifconfig.me. You can see a lot of useful details via a browser but you can use it in console as well!
curl ifconfig.me
and you’ll have your IP address!
curl ifconfig.me
> 37.47.XXX.XXX
or even more details with:
curl ifconfig.me/all
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:
ngrok http -host-header=rewrite HOST.local
traces
| where customDimensions.CorrelationId == "XXX"
| order by timestamp desc
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
AzureDiagnostics
| where ResourceType == "FRONTDOORS" and Category == "FrontdoorWebApplicationFirewallLog"
| where action_s == "Block"
| order by TimeGenerated desc
For so many times I am wondering which HTTP method should be used when I want to add, replace or modify a resource. Table below summarizes all the common methods and what they are doing.
HTTP Verb | CRUD | Meaning |
GET | Read | Get the resource. |
POST | Create | Create NEW resource. |
PATCH | Update/Modify | Modify part of the existing resource. Send only data you want to change. |
PUT | Update/Replace | Replace the existing resource with new one. |
DELETE | Delete | Delete the resource |
Source: https://www.restapitutorial.com/lessons/httpmethods.html
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.
Read/Write
mode in top of the page.subscriptions / YOUR_SUBSCRIPTION / resourceGroups / YOUR_RESOURCE_GROUP / providers / microsoft.insights / components
Edit
properties
property and put "DisableIpMasking": true
Patch
button since we are changing the part of the resource definition.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
Useful links if you want to call an Rest API endpoint during the login process from your AAD B2C:
https://docs.microsoft.com/en-us/azure/active-directory-b2c/restful-technical-profile
If you see
ValidationError: One or more fields contain incorrect values:
just add to your import script in release pipeline:
$DebugPreference="Continue"
and you will see more details!