Month: October 2017

Connect Batch of Azure VMs to Log Analytics (OMS) via PowerShell

So, you have a bunch of Virtual Machines (VMs) in Azure, and didn’t used an ARM template, and now need to connect the VMs to Log Analytics (OMS). Earlier this month, I demonstrated on this can be done with the ARM portal, here’s that blog post. Of course, this has to be done individually and can be very tedious if you have 10’s or 100’s of machines to do this to… All I can think of is PowerShell!

Here is a script I tweaked that Microsoft has already provided but for a single VM. I have just tweaked it to automate and traverse through your entire resource group, and add ALL VMs within the RG to Log Analytics.

Here is the link to Microsoft TechNet for that script. Please test it out and let me know. And if it helped you out, please give it a 5 start rating.

Microsoft TechNet PowerShell Gallery

If all went well, your before and after should look similar to this. I had two test VMs in my Resource Group.

Before:

After:

(more…)

Advertisements

What is Azure File Sync (AFS) and how to set it up?

Earlier this month, Microsoft introduced Azure File Sync (AFS). So, what is Azure File Sync (AFS)?

Azure File Sync is a cloud based backup solution for backing up and providing disaster recovery options for a single, or multiple file shares within a server, or multiple servers. Some of the benefits are:

  • Eliminates network and storage complexity and capacity planning, as it is done for you in Azure.
  • Changes to on-premises data are synchronized in real time to Azure, and file/folder backup is completely seamless to the end-user(s).
  • At the current time, AFS offers 120 days of data retention.
    • I suspect this will increase over time, and will allow administrators to have options with higher or lesser days of retention.

Setting up and configuring Azure File Sync is pretty quick. Below is how I setup Azure File Sync to sync a folder/files from my local server to Azure. AFS is pretty cool stuff, and I have been wanting to chat about it for some time (NDA). At any rate, getting AFS setup is pretty easy. Microsoft provides pretty good documentation on how to do this as well, but in my opinion, they have elected to omit some steps. Here is my take:

First you will need to create a new Azure File Sync Storage Sync. Within the Azure marketplace, search, “Azure File Sync“. Note, Azure File Sync is currently only available to a limited set of regions:

  • South East Asia
  • Australia East
  • West Europe
  • West US

Once created, under Sync, and getting started, download the Storage Sync Agent.

Note, Azure File Sync currently only works with Windows Server 2016 and Windows Server 2012 R2 (servers must be installed with a GUI — no core).

Download and install the agent on your local server, and configure it to the Storage Sync Service you just created in Azure.

Whoops, since this a brand new server install, there is no AzureRM PowerShell modules installed. Go ahead and launch PowerShell as an Administrator, and execute the cmdlet, “Install-Module AzureRM -force

Okay, back to the install. Remember to select the Storage Sync Service you just created in Azure

Once the install is complete, go back to Azure, and under Sync, Registered Servers, your local server should now be present.

Great, now we need to create a Storage account. We can either chose an existing storage account, or create a new one – I chose the ladder.

Regardless with route you take with the Storage account, go into the Storage account properties, and scroll down to File Service, and select Files.

Create a File Share, give it some name, and some quota. I gave it 1GB, as this is simply for testing and PoC. The file path is the same file path you want to backup to AFS. This file path should already exist on your local server(s).

Now go back to your Azure File Sync, and under Sync, and Sync Groups, create a new Sync Group. Within the Azure File Share, select the File Share we just created within our Storage account.

Finally, now we can create an server endpoint. Go back to your Sync Groups, and create a new server endpoint. Here you will need to specify the file/folder you will want to share/copy/backup to your Azure File Sync (AFS).

And that is it! Next I will show you how you can actually restore from your Azure File Sync.

Connect Azure VMs to Log Analytics (OMS) via ARM Portal

Let’s say you have a bunch of machines in Azure, and want them communicating with Azure Log Analytics (aka OMS). Well, I am pretty sure that last thing you want to do is deploy the Microsoft Monitoring Agent to each machine, manually…

Well, now you can connect a VM to Log Analytics (OMS) with just a few clicks.

Go into the ARM (Azure Resource Manager) portal, and navigate to your “Log Analytics” blade, select your OMS workspace name, and within the Workspace Data Sources, select Virtual Machines.

Here you should have your machines that currently live within Azure. As you can see, there is one machine that is not connected to the OMS workspace. Let’s connect it now.

Select the VM in question, and you will now be presented with the following:

Make sure the VM is online/running, and select Connect. The VM must be online in order for the extensions to be passed through.

Give it a few moments, and there we go! No manual agent deployment.

 

We can also verify now in OMS, to see our new machine chatting with Log Analytics. (Go into the Agent Health solution/title)