Azure Cloud Shell has an up to date PowerShell instance
az account show
az account set --subscription
| param($resourceGroup, $storageAccountName) | |
| # usage | |
| # Get-StorageAccountSize -resourceGroup <resource-group> -storageAccountName <storage-account-name> | |
| # Connect to Azure | |
| Connect-AzureRmAccount |
| openssl pkcs12 -export -out certificate.pfx -inkey private.key -in certificate.crt |
| /* Get top 100 executed Stored Procedures ordered by Execution Count */ | |
| ----------------------------------------------------------------------------------------------------- | |
| SELECT TOP 100 qt.text AS 'SP Name', qs.execution_count | |
| AS 'Execution Count', | |
| qs.execution_count/DATEDIFF(Second, qs.creation_time, GetDate()) AS 'Calls/Second', | |
| qs.total_worker_time/qs.execution_count AS 'AvgWorkerTime', | |
| qs.total_worker_time AS 'TotalWorkerTime', | |
| qs.total_elapsed_time/qs.execution_count AS 'AvgElapsedTime', | |
| qs.max_logical_reads, qs.max_logical_writes, qs.total_physical_reads, | |
| DATEDIFF(Minute, qs.creation_time, GetDate()) AS 'Age in Cache' |
| class TrustAllCertsPolicy : System.Net.ICertificatePolicy { | |
| [bool] CheckValidationResult([System.Net.ServicePoint] $a, | |
| [System.Security.Cryptography.X509Certificates.X509Certificate] $b, | |
| [System.Net.WebRequest] $c, | |
| [int] $d) { | |
| return $true | |
| } | |
| } | |
| [System.Net.ServicePointManager]::CertificatePolicy = [TrustAllCertsPolicy]::new() |
| function subscribe() { | |
| var email = $("#emailId").val(); | |
| $.ajax({ | |
| url: "https://docs.google.com/forms/d/e/1FAIpQLSc8TP0eS1iPwap4dVM6IlEWtkw_kHfpmDedlLWc5lQ88_2xCw/formResponse?", | |
| data: { "entry.1709137143": email}, // replace the numeric part of "entry.______" with the actual field name. more fields can be added in the data object | |
| type: "POST", | |
| success: function(d) {alert("thank you, you're subscribed to ngIndia 2020 updates")}, | |
| error: function(d) {alert("oops! something went wrong, please try again.")} | |
| }); |
| // install SQL Server Express if not installed | |
| // ensure SQL Server Express is running | |
| // start cmd with Admin Priviledge | |
| // navigate to C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator | |
| cd C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator | |
| // run | |
| AzureStorageEmulator.exe init -server . -sqlinstance SQLEXPRESS -forcecreate |
| $role = [Microsoft.Azure.Commands.Resources.Models.Authorization.PSRoleDefinition]::new() | |
| $role.Name = "Custom Role" | |
| $role.IsCustom = $true | |
| $role.Description = "Can perform assigned activities" | |
| $perms = 'Microsoft.Compute/virtualMachines/read','Microsoft.Compute/virtualMachines/write' | |
| $role.Actions = $perms | |
| $role.assignableScopes = "/subscriptions/11111111-1111-1111-1111-111111111111" | |
| New-AzRoleDefinition -Role $role |
| netsh interface portproxy add v4tov4 listenport=80 listenaddress=127.65.43.21 connectport=31661 connectaddress=127.0.0.1 | |
| netsh interface portproxy show v4tov4 | |
| netsh interface portproxy delete v4tov4 listenport=80 listenaddress=127.65.43.21 | |
| // append hosts file | |
| 127.65.43.21 <the domain name you want to debug> |
| var urlsFilePath = @"file.txt"; // file contains a tab separated filename/fileUrl combination on each line | |
| var lines = File.ReadAllLines(urlsFilePath); | |
| var outFileFolder = "images"; | |
| var httpClient = new HttpClient(); | |
| foreach (var line in lines) | |
| { | |
| var fileName = line.Split('\t')[0]; |