Change Azure Storage Blob Tiers

Imagine you had a whole lot of data stored in Azure, you also want to save the most money in storage costs. By default, Azure Blob Storate is set to the Hot tier for all blobs, the most expensive storage costs, but the cheapest to read. To give you an idea of the cost savings, here are General Purpose v2 storage account pricing below as of time of publication in US dollars:   HOT COOL ARCHIVE Storage | First 50 terabyte (TB) / month $0.0208 per GB $0.0152 per GB $0.0025 per GB Storage | Next 450 TB / Month $0.02 per GB $0.0152 per…

Move VMs from & to anywhere in Azure

Automatically move VMs from anywhere & to anywhere in Azure: Move VMs across subscriptions Move VMs across tenants In the same region or across regions No downtime on the source VM (if there’s no data disks), the source VM remains in-tact Copies both the OS disk and any data disks attached to the VM Both Standard & Premium managed disks supported Works with ARM Managed Disk based VMs only. This script is fully automatic and cleans up temp disks & storage accounts at the very end. It shows the copy process and doesn’t waste time by coping white space on…

Scheduled Task with a Logon Delay

Creating a Scheduled Task to run at logon with a delay is somewhat cumbersome with PowerShell, so as a result, you need to call the Task Scheduler Scripting Objects. Below walks you through it. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters $adminname = 'MyUser' $adminpassword = 'password' $taskName = "Start Studio" $ShedService = New-Object –comobject 'Schedule.Service' $ShedService.Connect() $Task = $ShedService.NewTask(0) $Task.RegistrationInfo.Description = $taskName $Task.Settings.Enabled = $true $Task.Settings.AllowDemandStart = $true…

Change Azure ARM VM OS disk

Sometimes you would want to create an Azure ARM based Virtual Machine using an existing VHD disk. It used to be much easier in ASM (Classic). However you can easily swap out the OS disk for a VM using PowerShell. This post focuses on swapping un-managed disks, however you can swap out managed disks now, since April 2018. Simply create a new (non-managed disk) based VM in Azure with new disks. Then you use PowerShell to swap out the OS disk with an existing disk. Good news is that the OS disk doesn’t have to be sysprepped, simply swap the…

Add additional NIC to Azure ARM VM

Sometimes you would want to add an additional Network Interface Card to a Microsoft Azure ARM (Azure Resource Manager) based virtual machine. PowerShell is your answer: This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters # Recently tested fully with a later version of the Azure PowerShell module – Install-Module AzureRM -RequiredVersion 4.4.1 #region Logon to Azure Login–AzureRmAccount $subscription = Get-AzureRmSubscription | Out-GridView –PassThru Select-AzureRmSubscription –SubscriptionId $subscription.Id #endregion # Variables…

PowerShell based Azure Functions v2

I am writing this for all PowerShell people, it’s not easy for non-developers or IT Pros who can use PowerShell only to grasp things like HTTP methods for example. Running PowerShell based Azure Functions allows you to do any type of function based stuff you would normally do with a PowerShell function, feeding it parameter values and getting output. Plus it makes you feel like a developer, where you can sort of create your own APIs! Using parameters and feeding parameter values to PowerShell functions Vs using PowerShell Azure Functions works slightly different. There are 3 ways to send parameter…

Quick & Dirty way to run PowerShell as a scheduled task

The PowerShell execution policy is there to protect us but not to stop us from doing the ‘not so best practice‘ things. Best practice would be to sign all your scripts with a code signing certificate, and by using ISE Steroids this makes this process much much easier with the click of a button. However there are times you just want to run a PowerShell script ‘as is‘ with the guarantee it will run – bearing in mind the default behaviour of a computer is Remote Signed meaning a PowerShell script from any remote source needs to be signed with…

Upload PFX Cert to Azure Key Vault

When was the last time you tried to upload a certificate to the Azure Key Vault? At the time of writing, you can’t from the portal. Good news, you can using PowerShell. Below will guide you how to upload a private key certificate to Azure Key Vault: This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters ### Log into Azure Add-AzureRmAccount $Subscription = (Get-AzureRmSubscription | Out-GridView –Title "Choose a Source…

Azure News 2017 – Week 32

Azure news below from the latest Need to Know podcast, episode 160. Announcing the new and improved Azure Log Analytics The Azure Log Analytics service is rolling out an upgrade to existing customers – offering powerful search, smart analytics and even deeper insights. This upgrade provides an interactive query language and an advanced analytics portal, powered by a highly scalable data store resembling Azure Application Insights. This creates a consistent monitoring experience for IT operations and developers. It is the biggest upgrade since its launch, this new and improved Azure Log Analytics brings you a simple yet very powerful query…

Storing Files safely & securely in Publicly Accessible Storage

I had a requirement recently in my adventures with Azure JSON/DSC VM deployment, I needed a way to store source files and software in a repository in a publicly accessible Azure blob storage container. So that post deployment, my VM could use DSC and pull down the source files, decrypt them and work with them. The only way I could do this is if I safely encrypted the files, so if someone got access to them, I wouldn’t really care, they’d be effectively useless. Below uses encryption using two strings passwords as well as any certificate’s thumbprint as added security….