Managing Azure workloads with Chef and PowerShell DSC at TechDays


Last week at TechDays me self and Fredrik Nilsson had a session about managing your workloads in Azure with Chef and PowerShell DSC. Despite the fact that we had the same timeslot as Arwidmark, Nystrom and Ben Armstrong our room was quite full of kung fu interested geeks 😉

Here is the presentation so you can find the links and info:

Screen Shot 2015-10-26 at 10.34.23


For you guys that did not have the opportunity to be there, a recording will be available although it is in Swedish…

Playing with automation of OMS agent deployment

I have been playing around with automation of the deployment of OMS agents in my lab environment and wanted to share one way to do it, of course there are others.

I found Adam´s contribution to send files over PS2+ WinRM instead of utilizing a remote share or other deployment of the installation file..  Sometimes you maybe have firewall constraints to take into consideration and then this is a handy way to get that MMAgent over and installed if you have maybe only PowerShell remoting open :-)

If you already have WMF 5 deployed you can utilize that instead of the Send-File function as it is in the new PowerShell version by default.

Screen Shot 2015-10-13 at 21.40.01

And here is the code:

good luck in deploying those OMS agents!


My Community PowerShell Jewels session on PowerShell Summit (links)

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.


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 :-)


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!


(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!