0

How do I remove custom script extension from a Azure scale set using powershell. the below script runs without any error but the extension is till there. Is something still missing?

# Get information about the scale set
$vmss = Get-AzureRmVmss `
                -ResourceGroupName $ResourceGroup `
                -VMScaleSetName $ScaleSet

Remove-AzureRmVmssExtension -VirtualMachineScaleSet $vmss -Name "customScript"
Update-AzureRmVmssInstance -ResourceGroupName $ResourceGroup -VMScaleSetName $scaleSetName -InstanceId "*"
kumar
  • 8,207
  • 20
  • 85
  • 176
  • Is wildcard for instance ID supported? I do not see it in the documentation: https://learn.microsoft.com/en-us/powershell/module/azurerm.compute/update-azurermvmssinstance?view=azurermps-5.7.0. Also how do you determine that extension is still there? – Alex S Apr 12 '18 at 17:06
  • Please try running Update-AzureRmVmss after Remove-AzureRmVmssExtension and before Update-AzureRmVmssInstance – Alex S Apr 12 '18 at 17:08

1 Answers1

0

$vmss = Get-AzureRmVmss -ResourceGroupName $RGName -VMScaleSetName $vmssName

Remove-AzureRmVmssExtension -VirtualMachineScaleSet $vmss -Name $vmssExtensionName

Update-AzureRmVmss -ResourceGroupName $RGName -Name $vmssName -VirtualMachineScaleSet $vmss