Hi,
I believe this is not possible or at least not fully. You could probably install the actual agent but installing the agent is only one part. After installation you need to register the machine to Azure by using service principal credentials. This second part will have to be ran every time you spin up a new server from that image. You will need to install the agent every time. When you try to add ARC server you can choose bulk mode. This will give you a script to do that. From that script this is the part where the agent (windows) is installed and you can put into your image
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
# Download the installation package
Invoke-WebRequest -Uri "https://aka.ms/azcmagent-windows" -TimeoutSec 30 -OutFile "$env:TEMP\install_windows_azcmagent.ps1"
# Install the hybrid agent
& "$env:TEMP\install_windows_azcmagent.ps1"
if($LASTEXITCODE -ne 0) {
throw "Failed to install the hybrid agent"
}
The part after:
# Run connect command
you will need to run every time a new machine is created from the image. That part registers the machine to Azure ARC by using that agent.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.