Friday, October 22, 2021

how to patch the VMSS ?

 step1 

Connect-AzAccount

step2


$Credential = Get-Credential Connect-AzAccount -Credential $Credential

step3

$Credential = Get-Credential Connect-AzAccount -Credential $Credential -Tenant 'xxxx-xxxx-xxxx-xxxx' -ServicePrincipal

step4

https://github.com/microsoft/OMS-Agent-for-Linux/blob/master/tools/OMIcheck/omi_check.sh

check the version 

and 

upgrade the version

https://github.com/microsoft/OMS-Agent-for-Linux/blob/master/tools/OMIcheck/omi_upgrade.sh


how to connect to the VMSS and upgrade the version ?

$VmssList = Get-AzVmss

# Change the filter to get whatever VMSS you are interested in

$Vmss = $VmssList | Where-Object {$_.Name -like "aks-agentpool-000000000*"}

# This will return a LIST of VMs in the VMSS

$VmssVmList = @(Get-AzVmssVm -ResourceGroupName $Vmss.ResourceGroupName -VMScaleSetName $Vmss.Name)

# Iterate through the list, change the index 0 to 1,2,3 depending on the count
Invoke-AzVmssVMRunCommand `
-ResourceGroupName $Vmss.ResourceGroupName -VMScaleSetName $Vmss.Name `
-CommandId "RunShellScript" -ScriptPath omi_check.sh -InstanceId $VmssVmList[0].InstanceId


Invoke-AzVmssVMRunCommand `

-ResourceGroupName $Vmss.ResourceGroupName -VMScaleSetName $Vmss.Name `

-CommandId "RunShellScript" -ScriptPath omi_upgrade.sh -InstanceId $VmssVmList[0].InstanceId


Invoke-AzVmssVMRunCommand `

-ResourceGroupName $Vmss.ResourceGroupName -VMScaleSetName $Vmss.Name `

-CommandId "RunShellScript" -ScriptPath omi_check.sh -InstanceId $VmssVmList[0].InstanceId









No comments:

Post a Comment