Azure / avdaccelerator

AVD Accelerator deployment automation to simplify the setup of AVD (Azure Virtual Desktop) based on best practices
MIT License
330 stars 209 forks source link

Idempotency issue when deploying Session Hosts #575

Closed TMirpuri13 closed 7 months ago

TMirpuri13 commented 8 months ago

What happened? Provide a clear and concise description of the bug, including deployment details.

As I have to consistently to deploy over development environment to get to the Production environment, I've found an issue recently where it is not processing the 'SessionHostConfig' extension correctly. It seems to because that the "SessionHostConfiguration.log" already exists within the host. Is it possible to include deleting the log before running the extension? Has this come up before in repository's testing?

Please provide the correlation id associated with your error or bug.

N/A - no correleation id attached, only the log below

What was the expected outcome?

The expected outcome is that the session host's extension would idempotently be deployed and this shouldn't affect the overlaying deployment every time. As this doesn't work for one host, eventually the other hosts are offline and the pipeline is unable to modify the extensions when the VM is not running.

Relevant log output

VM has reported a failure when processing extension 'SessionHostConfig' (publisher 'Microsoft.Compute' and type 'CustomScriptExtension'). Error message: 'Command execution finished, but failed because it returned a non-zero exit code of: '1'. The command had an error output of: 'New-Item : The file 'C:\AVDSessionHostConfig.log' already exists.
At 
C:\Packages\Plugins\Microsoft.Compute.CustomScriptExtension\1.10.15\Downloads\10\Set-SessionHostConfiguration.ps1:52 
char:9
+         New-Item -Path 'C:\' -Name 'AVDSessionHostConfi...' For more information, check the instance view by executing Get-AzVmssVm or Get-AzVm (https://aka.ms/GetAzVm). These commands can be executed using CloudShell (https://aka.ms/CloudShell)'. More information on troubleshooting is available at https://aka.ms/VMExtensionCSEWindowsTroubleshoot.  (Code: VMExtensionProvisioningError)
TMirpuri13 commented 8 months ago

@danycontre - as part of my testing of removing the C:\AVDSessionHostConfig.log in the dev environment has allowed for successful idempotent runs, however the run in preprod is failing for the same reasons above. Manually deleting the file is not a suitable fix to clean up the log each run.

danycontre commented 8 months ago

@TMirpuri13 thanks for the insights, we continue to review.

@moisesjgomez @swathibhat1

TMirpuri13 commented 7 months ago

Hi @moisesjgomez @swathibhat1 @danycontre - any updates on this bug please?

moisesjgomez commented 7 months ago

Hello @TMirpuri13 Could you help us to better understand your deployment please? Esp. with regards to how you are redeploying the environment to get to production state. The current templates are intended for a greenfield deployment, not necessarily for redeployment. Please help us to better understand your scenario so we may better target a resolution. Thank you!

cc: @danycontre @swathibhat1