ngrok http -host-header=rewrite HOST.local
Azure B2C App Insights – query for checking errors
traces
| where customDimensions.CorrelationId == "XXX"
| order by timestamp desc
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
AzureDiagnostics
| where ResourceType == "FRONTDOORS" and Category == "FrontdoorWebApplicationFirewallLog"
| where action_s =~ "block"
| order by TimeGenerated desc
HTTP Methods for RESTful Services
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
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.
- Go to https://resources.azure.com/ and pick proper AD you want to work with
- Click on
Read/Write
mode in top of the page. - Find your App Insight instance by going into
subscriptions / YOUR_SUBSCRIPTION / resourceGroups / YOUR_RESOURCE_GROUP / providers / microsoft.insights / components
- In Data tab click on
Edit
- Remove the content of the
properties
property and put"DisableIpMasking": true
- Hit
Patch
button since we are changing the part of the resource definition. - 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
Azure Active Directory B2C and REST API integration
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
Azure DevOps & Azure API Management import generic error
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!
SQL joins
Force https
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Zip directory per directory
for i in */; do zip -r "${i%/}.zip" "$i"; done