Share via


Add VM Agent - Resource Manager

Question

Wednesday, August 31, 2016 7:30 PM

I uploaded successfully a custom VM and it's running nicely. However the VM Agent is missing. So I installed it using the .msi you can find on the internet. Now I need to update the VM config. I tried this in PowerShell:

$vm = Get-AzureRmVM -ResourceGroupName $rgName -Name $vmName
$vm.OSProfile.windowsConfiguration.provisionVMAgent = $True
Update-AzureRmVM -ResourceGroupName $rgName -VM $vm

However I get an error:

The property 'provisionVMAgent' cannot be found on this object. Verify that the property exists and can be set.
At line:2 char:1

  • $vm.OSProfile.windowsConfiguration.provisionVMAgent = $True

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

Any idea what I can change?

Thomas Pagel

All replies (9)

Monday, September 5, 2016 2:28 AM ✅Answered | 1 vote

Hi,

>I installed the agent and can't see any statistics about the VM in the portal

To show the statistics on the portal, you need to enable the Diagnostics --> Basic Metrics on portal. And that's one of the reasons which makes me believe that my azure agent still works. When you enable the diagnostics, actually, you are installing an extension. The installation/removal of the extension is handled by azure agent, if the agent is not responsible, these actions will fail.

The most evident reason is the logs of the agent. The VHD I uploaded before is from my local hyper-v server, which means that I need to install the waagent manually. Then I failed to provision the diagnostic extension. So I went to the VM and check the logs of the waagent for troubleshooting. In the end, it turns out that this issues is caused by the DNS settings. I didn't change the DNS settings of the VM before I upload the VHD, then all name resolving fails which causes this issue.

Hope my experience helps you.

Best Regards,

Steven Lee
Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact [email protected].


Thursday, September 1, 2016 8:01 AM

Hello,

Thank you for posting on the Azure forums!

By manually downloading and installing the VM Agent (either the Windows or Linux version) on an existing VM instance and then setting the ProvisionGuestAgent value to true using PowerShell or a REST call. (If you do not set this value after manually installing the VM Agent, the addition of the VM Agent is not detected properly.) The following code example shows how to do this using PowerShell where the $svc and $name arguments have already been determined.

Note: Kindly follow this format:

$vm = Get-AzureVM –ServiceName $svc –Name $name
$vm.VM.ProvisionGuestAgent = $TRUE
Update-AzureVM –Name $name –VM $vm.VM –ServiceName $svc

For more details please refer below link :

https://azure.microsoft.com/en-in/documentation/articles/virtual-machines-windows-classic-agents-and-extensions/

Hope this helps!

Regards,

Monika

 

Kindly click "Mark as Answer" on the post that helps you, this can be beneficial to other community members reading the thread and also “Vote as Helpful”.


Thursday, September 1, 2016 8:06 AM

Hi Monika,

THANKS for your feedback. However the commands you listed and the article you linked are for the classic and not for Resource Management VMs. Unfortunately MS recommends using Resource Management without providing guidance how to execute the steps using this mode. In the comments below you see the feedback of users struggling with the process without success...

Best Regards,

Thomas Pagel


Thursday, September 1, 2016 8:32 AM

Did you try with the command below while provisioning your VM from existing vhd?

Set-AzureRmVMOperatingSystem -VM $vm -Windows -ComputerName $vmName -Credential $cred -ProvisionVMAgent -EnableAutoUpdate

Bhushan | Blog | LinkedIn | Twitter


Thursday, September 1, 2016 8:37 AM

I tried but that didn't work during deployment. In fact it looks like that this command only works when you deploy a new VM based on an image but not when you use a custom VHD...

Thanks,

Thomas Pagel


Thursday, September 1, 2016 10:44 AM

Hi,

I've tried to create a VM with an existing VHD before. I encountered same issue with you.

Here are my conclusions:

  • Osprofile can not be edited after deployment.
  • Osprofile can not be set if we are not installing a new OS. (For example, using a existing VHD)

In my lab, the waagent still works if I leave the Osprofile blank.

Hope this information helps.

Steven Lee
Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact [email protected].


Thursday, September 1, 2016 12:16 PM

Thanks Steven for your feedback... When you say the Agent still works, what does that mean? I.e. I installed the agent and can't see any statistics about the VM in the portal... Also I assume that shutting down the VM will be now like a "power off" instead of a "clean shutdown"...

Thomas Pagel


Monday, September 5, 2016 9:34 AM

Thanks Steve, so it seems that it was my fault, you were totally right, basic diagnostics were not enabled, as soon as I enabled them I see the chart in the portal so I think the agent just does what it's supposed to...

I'm not completely sure about your second paragraph, I guess I'm fine in this respect since the agent is working now. But perhaps I didn't understand "diagnostic extension" correctly...

THANKS!!!

Thomas Pagel


Thursday, August 2, 2018 12:03 PM

Thanks Stevan. However If i have a different VMname and different Hostname inside the same VM, Will it create a problem for VM Agent not to function well? Also Where can i see the Agent Logs?