Error enabling Insights for VMSS

shaswat anand 96 Reputation points
2020-09-06T17:34:01.117+00:00

Hi,
I am using following script to provision resources.

*#!/bin/bash

Variables

resourceGroup="acdnd-c4-project"
location="westus2"
osType="UbuntuLTS"
vmssName="udacity-vmss"
adminName="udacityadmin"
storageAccount="udacitydiag081"
bePoolName="$vmssName-bepool"
lbName="$vmssName-lb"
lbRule="$lbName-network-rule"
nsgName="$vmssName-nsg"
vnetName="$vmssName-vnet"
subnetName="$vnetName-subnet"
probeName="tcpProbe"
vmSize="Standard_B1ls"
storageType="Standard_LRS"

Create resource group

echo "Creating resource group $resourceGroup..."
az group create \
--name $resourceGroup \
--location $location \
--verbose
echo "Resource group created: $resourceGroup"

Create Storage account

echo "Creating storage account $storageAccount"
az storage account create \
--name $storageAccount \
--resource-group $resourceGroup \
--location $location \
--sku Standard_LRS
echo "Storage account created: $storageAccount"

Create Network Security Group

echo "Creating network security group $nsgName"
az network nsg create \
--resource-group $resourceGroup \
--name $nsgName \
--verbose
echo "Network security group created: $nsgName"

Create VM Scale Set

echo "Creating VM scale set $vmssName"
az vmss create \
--resource-group $resourceGroup \
--name $vmssName \
--image $osType \
--vm-sku $vmSize \
--nsg $nsgName \
--subnet $subnetName \
--vnet-name $vnetName \
--backend-pool-name $bePoolName \
--storage-sku $storageType \
--load-balancer $lbName \
--custom-data cloud-init.txt \
--upgrade-policy-mode automatic \
--admin-username $adminName \
--generate-ssh-keys \
--verbose
echo "VM scale set created: $vmssName"

Associate NSG with VMSS subnet

echo "Associating NSG: $nsgName with subnet: $subnetName"
az network vnet subnet update \
--resource-group $resourceGroup \
--name $subnetName \
--vnet-name $vnetName \
--network-security-group $nsgName \
--verbose
echo "NSG: $nsgName associated with subnet: $subnetName"

Create Health Probe

echo "Creating health probe $probeName"
az network lb probe create \
--resource-group $resourceGroup \
--lb-name $lbName \
--name $probeName \
--protocol tcp \
--port 80 \
--interval 5 \
--threshold 2 \
--verbose
echo "Health probe created: $probeName"

Create Network Load Balancer Rule

echo "Creating network load balancer rule $lbRule"
az network lb rule create \
--resource-group $resourceGroup \
--name $lbRule \
--lb-name $lbName \
--probe-name $probeName \
--backend-pool-name $bePoolName \
--backend-port 80 \
--frontend-ip-name loadBalancerFrontEnd \
--frontend-port 80 \
--protocol tcp \
--verbose
echo "Network load balancer rule created: $lbRule"

Add port 80 to inbound rule NSG

echo "Adding port 80 to NSG $nsgName"
az network nsg rule create \
--resource-group $resourceGroup \
--nsg-name $nsgName \
--name Port_80 \
--destination-port-ranges 80 \
--direction Inbound \
--priority 100 \
--verbose
echo "Port 80 added to NSG: $nsgName"

Add port 22 to inbound rule NSG

echo "Adding port 22 to NSG $nsgName"
az network nsg rule create \
--resource-group $resourceGroup \
--nsg-name $nsgName \
--name Port_22 \
--destination-port-ranges 22 \
--direction Inbound \
--priority 110 \
--verbose
echo "Port 22 added to NSG: $nsgName"
echo "VMSS script completed!"*

after provisioning when I try to enable "Insights" under my "udacity-vmss" it gives error as "Can not perform requested operation on nested resource. Parent resource 'udaloganalytics' not found. (Code: ParentResourceNotFound)"

I tried deleting resources & reinstalling it multiple time, but always getting same error.

Azure Virtual Machine Scale Sets
Azure Virtual Machine Scale Sets
Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
364 questions
0 comments No comments
{count} votes

Accepted answer
  1. shaswat anand 96 Reputation points
    2020-09-06T18:42:09.897+00:00

    The problem has been resolved after clearing out the SSH public keys before re-installing my resources.


1 additional answer

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 18,877 Reputation points Microsoft Employee
    2020-09-11T01:00:40.763+00:00

    @shaswat anand Sorry for the inconvenience caused due to this.

    There are 2 pre-requisites when you want to enable azure monitor insights for your VM/VMSS:

    1. Create and configure a Log Analytics workspace.
    2. See Supported operating systems to ensure that the operating system of the virtual machine or virtual machine scale set you're enabling is supported.

    This can also happen if the workspace is deleted. Can you please check if the workspace 'udaloganalytics' exist or it is deleted?
    Here is the article on recovering you log analytics workspace with steps:
    https://learn.microsoft.com/en-us/azure/azure-monitor/platform/delete-workspace

    Let me know if everything mentioned above is correctly set up and I can help troubleshoot further.

    0 comments No comments