mikebai.com

  • Home
  • dev
  • DotNET
  • M365
  • 搞笑
  • 杂七杂八
  • FocusDict
個人BLOG
it developer
  1. Main page
  2. M365
  3. Main content

Adding Diagnostic Extensions to an Existing Azure VM Scale Set

2021-03-19 154hotness 0likes 0comments

There are some options to create a Virtual Machine Scale Set with the diagnostics extension to perform in-guest monitoring and collect metrics from inside your virtual machines.

On the other hand, if you have an existing Virtual Machine Scale Set without such extension, there’s a way to enable them. This is what I’ll show in this post in a detailed way explaining how to configure each one of the parameters required.

How do I know if I have diagnostics extension deployed or not?

The first thing to notice if you are looking to monitor your guest VMs in a VM Scale Set is if you already have the extension deployed or not. This is easy to be accomplished by going to the VMSS page in the Azure Portal and clicking on Metrics. If there are no metrics available in the Guest section this means there’s no diagnostic extension installed and only metrics provided at the Host level, captured by the virtualization layer are available. The picture bellow shows this scenario:

Checking if guest diagnostics extension is enabled or not
Checking if guest diagnostics extension is enabled or not

So, as there’s no Guest metrics available, we can conclude that the extension is not installed and we can install it.

Storage Account

To hold diagnostics data we need a storage account provisioned, you can provision a new storage account or use an existing one.

Getting the Default Config

The first step to work with Azure VM Scale Set diagnostics is to get the default config. This is a template file we use to enable the diagnostics extension and also we can customize it to fit our needs.

You can run the following command to get the VMSS diagnostic config file and send it to a file named config.json:

az vmss diagnostics get-default-config > config.json

You will notice that a config.json file will be generated in the current folder while another JSON will be output to the screen as shown bellow.

Protected settings JSON shown in the console
Protected settings JSON shown in the console

Copy this JSON as it will be the one you will use to put protected data like the Storage Account SAS Token and place it in a file called protected-settings.json. We will use both files.

Fill the protected-settings.json with the storage account information. In the storageAccountName field, enter the name of the storage account you provisioned to hold diagnostics data and in the storageAccountSasToken enter a SAS token you can generate in the storage account in the Shared access signature section. Just make sure you don’t include the question mark. Also make sure you select a large time frame for the token or you will have to update it later as by default it is valid for just a few hours.

The resulting config will look like the following:

Tag: Nothing
Last updated:2021-03-19

mikebai

This person is a lazy dog and has left nothing

Like
< Last article
Next article >

COPYRIGHT © 2025 mikebai.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang