VM Application install script not running

Ana Mata-Payerro 20 Reputation points Microsoft Employee
2025-09-25T21:50:50.2433333+00:00

I'm following the directions from this tutorial: https://free.blessedness.top/en-us/azure/virtual-machines/vm-applications-how-to?tabs=ZIPPowershell%2Ccli1%2Ccli2%2Crest3%2Crest4 I'm able to create a VM application and when adding the application to my virtual machine scale set it says the application was successfully installed. However, when I bastion connect to a VM instance, it doesn't seem like my application was installed (the zip file hasn't even been unzipped). I'm wondering if I could get some guidance. I'm using an azure devops pipeline to create the vm application https://free.blessedness.top/en-us/azure/virtual-machines/vm-applications-how-to?tabs=ZIPPowershell%2Ccli1%2Ccli2%2Cdevops3%2Crest4#create-the-vm-application. If it helps at all, I'm trying to install this sample project (deleting link) and this is what's inside my install-script-as-string.txt file:

powershell.exe -command "Rename-Item -Path '.\MyVMApp' -NewName 'VMSSPackage.zip'; Rename-Item -Path '.\MyVMApp-config' -NewName 'ServiceConfiguration.Cloud.cscfg'; Expand-Archive -Path '.\VMSSPackage.zip' -DestinationPath '.\app'; Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force; Set-Location -Path '.\app\scripts'; powershell.exe -ExecutionPolicy Bypass -File .\Install.ps1 -Config '..\..\ServiceConfiguration.Cloud.cscfg' -DeploymentId 1 -EnableOlderTlsVersions \$true -DisableHttp2 \$false -NegotiateClientCert \$false"

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.
{count} votes

Answer accepted by question author
  1. Ankit Yadav 4,145 Reputation points Microsoft External Staff Moderator
    2025-09-26T01:55:52.8466667+00:00

    Hello Ana Mata-Payerro,

    We have tried a manual replication of your scenario to identify potential root causes to help you out.

    We deployed your application package to a test VM using the same installation command and methodology as VMSS VM Applications (downloaded the files manually in the VM and then ran installation). Our manual testing revealed below findings that may explain why your application appears to install successfully but doesn't function as expected on VMSS instances.

    Issues observed:

    1. Application Reboot Requirement:
      ->Your installation script is designed to automatically reboot the system after installation. ->This behavior disrupts VMSS deployment as reboots interrupt the VM Application Manager's status reporting. ->The reboot occurs before the installation can be properly verified and reported.
    2. Relative Path Dependencies: -> The installation uses relative paths that reference temporary directories. -> Services get configured pointing to paths like "C:\VMAppTest\TestRun_20250926_000422\app\agent\KeyVaultAgent.exe". These temporary paths become invalid after installation, causing service failures.
    3. Service Configuration Issues: -> The Key Vault Agent service installs but fails to start due to incorrect executable paths. -> Services are created but remain in "Stopped" state without automatic recovery.
    4. Web Application Configuration:
      -> IIS website and application pool are configured but not automatically started.  -> HTTPS binding is configured without proper SSL certificate setup.

    Based on our testing, we recommend reviewing these components in your application package :

    1. Primary Scripts: Install.ps1 - Contains reboot commands and relative path references Bootstrap.ps1 - Main installation logic may need path adjustments
    2. Configuration Files: ServiceConfiguration.Cloud.cscfg - Verify service paths and dependencies Application configuration files that may contain temporary path references

    Key Areas for Fixes :

    1. Remove or modify reboot commands for VMSS compatibility.
    2. Replace relative paths with absolute paths or environment variables.
    3. Add service health checks and automatic start procedures.
    4. Implement proper error handling for VMSS environments

    Recommended Next Steps:

    1. Test with our corrected installation approach that addresses the path and reboot issues
    2. Modify your installation scripts to be VMSS-compatible by:  
      ->Eliminating system reboots. -> Using absolute paths for service executables   -> Adding proper startup sequencing for services
    3. Validate the application works manually before deploying to VMSS
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.