Azure PowerShell: Copy All Files in Blob Storage to Local Directory
Here’s a Azure PowerShell script that downloads all blobs in a storage container to your local disk: $storageAccountName = "mysuperstorage" $containerName = 'my-blobs' $destinationFolder =...
View ArticleT-SQL: Find Out Who Has Locks In Your Databases
Here are a couple of ways to see who is locking up your SQL Server database. First, the undocumented system stored procedure sp_who2 gives you a few more columns than the documented sp_who. And second,...
View ArticlePowerShell: Extract Files from Zip Archive
Here’s a quick PowerShell snippet to extract files from a .zip archive: Add-Type -Assembly System.IO.Compression.FileSystem $PathToZipFile = "C:\temp\myarchive.zip" $ExtractPattern = "*.log"...
View ArticleDOS to Linux line endings in VIM
Switching between Windows and Linux machines every day, you’ll undoubtedly end up with files in the Linux system with DOS line endings. You can easily change the line endings in the editor VIM using...
View ArticleSo, you can’t delete a folder in Windows because of “Path too long” errors?
If you have got yourself into a situation where you can’t delete a directory in Windows because the folder structure is too deep for Windows, you can use robocopy to save the day. Here’s a little...
View ArticleAzure PowerShell: Deploy Linux Custom Script Extension
Here’s how you can deploy an Azure VM Extension via PowerShell: # Before running this, upload your bash script to an Azure storage account container, grab its name and key via PowerShell or the Azure...
View ArticlePowerShell: Generate Self-Signed Certificate and Encode to Base64
Here’s how you can generate a self-signed SSL certificate in PowerShell. Be sure to use an Administrative PowerShell session. After creating the self-signed certificate, you can also export the...
View ArticleAzure PowerShell: Querying Kudu WebJobs API
Here’s how you can query the Kudu WebJobs API to get the publishing credentials for an Azure App Service which in turn you can use to in a Basic authorization header of an HTTP request to get WebJob...
View ArticleAzure PowerShell: Scale App Service Plan to Save Money
Here’s a bit of PowerShell to scale your Azure App Service down to save money. This task could be scheduled to “size down” at night, and “size up” for business hours. Login-AzureRmAccount...
View ArticleOpenSSL: Generate PFX from CRT and PEM
Here’s how you can use OpenSSL to generate a PFX file from a CRT (public key) and PEM (private key) file set. "c:\OpenSSL-Win64\bin\openssl.exe" pkcs12 -export -out www.mysite.com.pfx -inkey...
View Article