Using Azure Functions with Dynamics 365

If you read What’s new for developers in Dynamics 365 (online), version 9, you’ll come across a new WebHooks integration feature.  When you combine this feature with Azure Functions you get a pretty powerful combination.  Since I’m a big fan of watching videos vs reading docs, I decided to put together a quick walkthrough of what the docs explain plus add act of wiring up to an Azure Function.  An activity the docs suggest, but leave to the reader to figure out how to do.


Getting started using TypeScript with Dynamics 365


I’m familiar with TypeScript, but not quite sure how to apply my knowledge to start using it with Dynamics 365.  How do I get started?

I’ve been asked this a few times.  I didn’t find anything out there (or my search skills are failing me) that was an end to end walkthrough.  I found a bunch of stuff that, once reviewed, one could figure it out, arguably with significant trial and error.  So I decided to put together a little walkthrough of how I do it. 

In the video, I use some extensions to Visual Studio and NuGet packages.  Here are links to the ones I mention:

Hope this helps!


ANNOUNCING: Dynamics 365 DevOps on GitHub

I’ve recently switched back to focusing on Dynamics 365 after some time focusing on Azure again.  Back to the future.  My team and I have been working on an effort to move all of our Dynamics 365 (and in some cases Azure) based demos, Proof of Concepts (POCs), samples, etc. into Visual Studio Team Services (VSTS), and “rub a little devops on them”.  In the process, we’ve learned a lot (and continue to learn) how to best apply build automation and deployment (amongst other DevOps concepts) to Dynamics 365 applications.  We’ve had a chance to use great community projects like which provide (amongst other things) Dynamics 365 VSTS tasks and  In the process, we’ve had the opportunity to contribute back to both. 

What became apparent, very quickly, is that we needed to share what we learn with the rest of the community.  In an effort to do so, we started  I welcome you to review what we’ve put together so far.  Even better provide us feedback.  Try it out and file bugs.  Suggest better ways to document what we’ve done.  Tell us how to improve the base templates.  Suggest additional templates / scenarios.  Really, tell us anything you think that will make what we’ve started better for others.  Please do so by submitting issues.  We will triage the issues and prioritize accordingly.

We’re intentionally *not* trying to boil the ocean here or over engineer the idea.  We’re building small and evolving as the community of people who are interested in the project grow and provide feedback.  The project will head in the direction that the community takes it.  Thanks!


Contributing to Azure Quickstart Templates for Azure Government

The Azure Quickstart Templates are community contributed ARM templates to help people get started with and accelerate the deployment of common scenarios in Azure.  Unfortunately, many of the templates don’t work in Azure Government.  Since these templates are contributed by the community, the original contributors may not even know that they need to update their templates.  The good news is that ensuring new templates work in multiple Azure environments is part of the current guidance.  However, for existing templates, it’s going to take members of the community, like you and me, to ensure that these templates get updated.  I’ve updated a few of them already. 

Based on feedback from others who I’ve been helping contribute, I’ve recorded some “how to” videos that focus on the Azure Government specific nuances.  I’d like to encourage you to consider contributing.

I’ve organized this into two parts.  The first part really just focuses on the GitHub part of contributing.  In fact, the template in the first video already works with Azure Government.  I really just walk you through how to update the file and metadata.json file, then submit the pull request.

In the second video, I make a number of common changes necessary in order to get a template deployable to Azure Government.

While this walkthrough focuses on Azure Government, these are the same kinds of changes necessary to make templates deployable to other environments like AzureChina, Azure Stack, and others.



Custom Autoscale for ARM Virtual Machines in Azure Government


“I want to automatically scale Azure Resource Manager (ARM) Virtual Machines in Azure Government.  I do not want to use Virtual Machine Scale Sets (VMSS).”

The video below walks through the following code sample, which addresses the scenario above:

My sample is an adaptation of the Custom Auto Scaling for Azure ARM Virtual Machines sample.  The video explains the differences, how the code works and how to get it deployed and running.

As I point out at the end of the video, this general approach could also be adapted to implement custom autoscale for other services in Azure Government such as App Service, VMSS, and SQL Database.


Install Windows Updates on an Azure VM using Azure Automation


“I want to use Azure Automation to install Windows Updates on my Azure VM.  All the examples I have come across were written with Azure Service Management (ASM) based PowerShell scripts.  Are there any examples of doing this with Azure Resource Manager (ARM) VMs?”

I looked around at other examples of how to do this, including this one:

I too only found ASM examples.  The video below is a walkthrough of using the sample scripts from my GitHub repository:

Some notes about my scripts which make them different from most of the ASM examples I reviewed.  The runbook script uses PowerShell Remoting to invoke commands on the VM.  WinRM is required for PowerShell Remoting.  ARM VMs don’t have WinRM enabled by default.  My video doesn’t cover configuring WinRM.  I’d recommend enabling WinRM through ARM templates as described here:

If you have existing ARM VMs that need to have WinRM enabled, see: 

I use Azure Automation DSC to ensure that the VMs have the prerequisite PSWindowsUpdate and TaskRunner modules installed locally.  For simplicity, the runbook script accesses the VM using PowerShell Remoting over ssl via public IP/DNS label.  If you prefer to not expose VMs over the public internet you could consider using Azure Automation Hybrid Runbook Workers:


Manual failover of Azure File storage

UPDATE (10/13/2016): Added video

Customer scenario:

“I have a deployment architecture in Azure which requires web servers (but can be anything) communicate with a remote file share.  I want to use Azure File storage.  I also need to maintain a geographically redundant environment in another Azure region.  I am required to demonstrate end to end execution of my disaster recovery plan.  The end result must show all pieces of my deployment architecture running in the other region. “

The first question to this scenario might be: “What about Geo-redundant storage (GRS)?”  The answer to that question is that since, at the time of this post, GRS doesn’t give you fine grained control to force Azure Storage to switch to using the replica in the other region, it won’t meet the customer scenario of being able to prove storage has failed over.  Note that if you are ok with trusting that GRS will failover in the event of a disaster (as documented) and aren’t *required* to prove it, then you can stop reading this post.  Just use GRS.  “What about Read-access geo-redundant storage (RA-GRS)?  Can’t I rely on RA-GRS to perform the replication for me and just use something like AzCopy to copy the read-only replica into a new storage account? The end result being a fully functioning share based on the replica?” You could if Azure File storage supported RA-GRS.  It doesn’t at the time of this post.

I put together a little code sample to demonstrate one approach to address the scenario above:

Here is a video walkthrough of the sample: