TechDays Session: Managing your Azure workloads with Chef and PS DSC

Are you possibly going to the TechDays Sweden this autumn ? Me self and my friend and former colleague Fredrik Nilsson will have a session on this conference about automation and how to use Chef and PowerShell DSC for your deployment.

Screen Shot 2015-06-24 at 10.20.32
This session will focus on how Chef, a systems and cloud infrastructure automation framework, can manage both Windows and Linux workloads on Azure or any physical, virtual location no matter the size of the infrastructure easily.

We will also look at how Chef can interact with PowerShell Desired State Configuration to deliver a consistent and compliant infrastructure. In this session you will learn the basic paradigms of Chef, launching VM instances and deploying applications to these instances. It is DevOps times now with a faster and agile world where the IT-Dinosaurs will have to watch out! 

 

Download SysCtr Technical Preview 2 eval VHD´s with Powershell

I have just updated my script that allows you to download all or selected roles of the newly released System Center Technical Preview 2 that was announced on Ignite.

Update 2015-06-12 :  Now I configured a If that checks if the file already is downloaded…

It will depending on your broadband connection take various of hours getting all the files..

Good luck in testing those new things you learned about from Ignite :-)

My presentation on MS Ignite on “PowerShell Community Jewels”

I had an Community Theater Session this Tuesday on the Microsoft Ignite conference and so fun that there was about 100 people showing up in the area that was sized for about 40! I promised that I was going to put my slides on my blog so that you could see and get the links and info. The Session was about 15 minutes.

mysessuin

Sadly there was no recording on these sessions but here is the PowerPoint for you :-) NiklasAkerlund_May5_105PM_1

Downloading MS Ignite content with PowerShell and Bits from CH9

So after the first day of Microsoft Ignite I have altered the script I had for Teched and now I can present the first version that download the material,

Update # 2: I had some brainfreeze with the first version of the script so now Markus Bäker helped me with some fixes so now it actually works 😉 Thanks a million!!

UPDATE: It has started to appear videos on the channel 9 rss and I will monitor during the day. There are some categories now in the script so if you are only interested in cloud or iaas then you do not have to download all!, the plan is to have all categories in place so you do not have to download all 800+ sessions :-)

dowloadkontent

You can though use the -All parameter to get all the files .. as I use logic to check if the file have been downloaded I will not download any material twice.

If you want to follow my script I have it on GitHub where you probably will find the latest version !

 

Watch out, extended OS disk in Azure IaaS VM makes it not bootable

After a week of Azure Ninja course at Microsoft Sweden I wanted to dig a bit deeper into Azure IaaS.

I found that the Update-AzureDisk had a new parameter that looked interesting -ResizedSizeInGB and I wanted to test that one in real action on the OS disk which resulted in a VM that could no longer be started :-(. As described in an earlier post it was a bit more difficult to extend a vhd for a VM in Azure before this powershell way and in those days you had to tear down the VM and throw it away and also the pointer to the blog and after that you could with a tool extend the blob.

Screen Shot 2015-04-23 at 17.22.03

So far it looked good but when I then tried to start the VM I got the error

Screen Shot 2015-04-23 at 18.43.57

This VM was provisioned from the gallery and after reading the blog about the changes in Azure and that the OS disk now could support 1 TB in size i also found this little text saying that it only applied to disks that was migrated to Azure and not the gallery items or already provisioned VM´s…

Screen Shot 2015-04-24 at 14.56.10

So I wanted to test the same thing as above for a migrated vhd, first of all I created a vhd on-premise with 140GB vhd and then used powershell Add-AzureVhd to upload it.

Screen Shot 2015-04-24 at 14.33.45

after that I created a VM and started it with no problems :-)

And then I ran the above resize parameter on this uploaded vhd to extend it to 150GB. With the PowerShell cmdlet I can apply this to a VM that is not running and do not need to remove any relations to the blob or VM´s.

Screen Shot 2015-04-24 at 14.33.22

Started it and as you can see it worked nicely

Screen Shot 2015-04-24 at 14.58.39

Here you can see when looking inside the VM and checking the Disk manager it shows the extra 10 GB

Screen Shot 2015-04-24 at 14.32.34

So watch out if you test to extend your Production VM´s VHD´s depending on where they have come from, although an OS volume does not need to be too large..

I have tested the Update-AzureDisk -ResizedSizeInGB on VM Data disks without any issues no matter if they were created or uploaded so this warning just points at the OS disk!

My Theater Community Session on Ignite – be there or …

Today I was browsing the session catalog on myIgnite and could see that my session “PowerShell Community Jewels” was now added to the list!

Screen Shot 2015-04-22 at 09.21.40

So if you will be going to Chicago and also attending the Microsoft Ignite conference I would love to see you on the Lounge B Theater on Tuesday!

Me self and The Swedish Chef will be there and maybe just maybe there will be a possibility for you to take a selfie with the Chef after the session!

10271304_745037768850455_7817596746289511557_o

(Last year at Teched Houston with Mr PowerShell himself)

 

Playing with the Azure VM agent and changing user on IaaS VM with PowerShell

I am at a Azure training at Microsoft and have been playing a bit with both the portal and PowerShell.

We where talking about the VM agent that is installed on the IaaS VM´s and what functionality it has.

There is a nice and powerful feature that allows you to reset the password for the user from the Azure PowerShell console. The cool part is that you also can change the user on the VM so if you have to take over a Azure IaaS deployment and do not know the username or password for the virtual machines you can change it!

from Keith Mayers blog post I used the PowerShell code and changed both password and username for a user

So first of all in my Windows 2012 R2 I have a user vniklas and I want to change it to Bruno, but as I said above you do not have to know the username that is set inside the VM´s to be able to change it!

Screen Shot 2015-04-20 at 16.33.09

And I use PowerShell to set a credential with username and password:

Screen Shot 2015-04-21 at 10.14.56

And the following change both user and password, updates the VM and then to actually get it to hit on the VM I need to restart the VM:

Screen Shot 2015-04-21 at 10.24.11

And when you then try to use RDP in to the VM you need to use the new password and username and as you can see on the Local Users the account have changed to bruno instead.

Screen Shot 2015-04-20 at 16.21.53

Here is the PowerSHell code to get this to work:

And now as you see that this is so easy you can realize that your Azure subscription account becomes quite important to keep safe and not let anyone get access to it.

May the force be with you!

Hyper-V Powershell module now with 211 cmdlets in build 10041

I have upgraded my windows 10 to the latest build 10041 and activated Hyper-V.

Screen Shot 2015-03-20 at 09.45.22

In this build I can see that there are now 211 cmdlets in the hyper-v PowerShell module:

Screen Shot 2015-03-22 at 10.58.57

And comparing it to the PowerShell module that was released in Windows 8.1/2012 R2 you can see the following new cmdlets, although the Windows 10 is in preview and things can change before it is released!

Screen Shot 2015-03-22 at 11.32.16

I will dig into the new preview release and maybe there will be a followup post on my findings!

Hyper-V VM´s BIN files, to be or not to be in clusters

If you create lots of VM´s with large amount of RAM memory assigned to them and start to wonder why you have used some of the storage on the volumes then this is because if you have set up a VM without changing anything you get a bin file in the VM folder that corresponds to the size of the allocated RAM. This file is used to save the VM`s RAM to disk when the VM is going into saved state!

Screen Shot 2015-02-19 at 12.23.41

In an environment where you have all VM´s as clustered resources you will not need to be able to use the saved state when shutdown the host as you will live migrate the VM´s when doing stuff with the HW.

The setting is easily found in Hyper-V Manager for an already deployed VM:

Screen Shot 2015-02-19 at 12.22.06

It is not so easily found in System Center VMM when checking the VM properties, but when deploying a new VM you find it in the wizard:

Screen Shot 2015-02-19 at 12.29.26

If you want to change the setting for your VM´s running in a cluster via VMM you will have to use PowerShell and it is quite easy to do that with a one-liner, first you see the setting with the PowerShell command Get-SCVirtualMachine and then you can configure it with Set-SCVirtualMachine :

Screen Shot 2015-02-19 at 12.40.18
Screen Shot 2015-02-19 at 13.29.46

And now when checking the folder for the VM the BIN file has magically shrunk to 4KB :-)

Screen Shot 2015-02-19 at 13.44.03

VM Storage Migration in VMM 2012 R2 leaves unwanted leftovers

I have been playing around with a case where we have been upgrading and creating a new Windows Server 2012 R2 Hyper-V cluster and adding CSV volumes to it, and when first volume became full we started to storage migrate the VM´s to another volume but for some reason the files where left behind so I created my own PowerShell function to handle that as the built-in does not have that parameter and for some reason leaves leftovers?!

As you can see when I have done a live storage migration within a Hyper-V host with the GUI in VMM it leaves both vhdx and xml of the VM, and that can be troublesome when someone tries to import that VM while the other is already running and also you do not gain that space you thought would be reclaimed because you did a live storage migration.

Screen Shot 2015-02-16 at 15.38.54

No problem to move but as you can see in the volume that I migrated from:

Screen Shot 2015-02-16 at 15.06.32

And the volume that I migrated to:

Screen Shot 2015-02-16 at 15.06.55

I have been reproducing the migration with either just folders or both folders and vhdx/xml files still at the source..

When I run my function it cleans the source if i use the parameter -deletesource

Screen Shot 2015-02-17 at 15.51.08

Here is the PowerShell function for you to try:

Good luck in your automation :-)