Azure / appservice-landing-zone-accelerator

The Azure App Service landing zone accelerator is an open-source collection of architectural guidance and reference implementation to accelerate deployment of Azure App Service at scale.
https://build.microsoft.com/en-US/sessions/58f92fab-3298-444d-b215-6b93219cd5d7?source=sessions
MIT License
200 stars 95 forks source link

vm custom script did not work in azure devops #171

Closed thomas-tran closed 11 months ago

thomas-tran commented 1 year ago

@thotheod I've cloned this repo to Azure devops repo and modify the https://github.com/Azure/appservice-landing-zone-accelerator/blob/main/scenarios/shared/bicep/compute/jumphost-win11.bicep to use the devops repo uri instead https://dev.azure.com/xxxx/xxx/_git/Infrastructure?path=main/scenarios/shared/scripts/win-devops-vm-extensions/post-deployment.ps1

image

However, the deployment got shown an error The term './post-deployment.ps1 .ps1' is not recognized as the name of a cmdlet, function, script file, or operable program

Note: Github and other direct blob storage is working fine however only the file came from Azure devops got this issue How to fix the issue?

thotheod commented 12 months ago

Hi @thomas-tran, I think the issue is that the URL that you are providing is not the raw content of the file, but rather the html page showing the contents of the file. Using github as an analogy, the devops URL that you are providing is (in GitGub) this one: https://github.com/Azure/appservice-landing-zone-accelerator/blob/main/scenarios/shared/scripts/win-devops-vm-extensions/post-deployment.ps1

but the raw file (in GitHub) is taken from the URL https://[raw.githubusercontent.com/Azure/appservice-landing-zone-accelerator/main/scenarios/shared/scripts/win-devops-vm-extensions/post-deployment.ps1](https://raw.githubusercontent.com/Azure/appservice-landing-zone-accelerator/main/scenarios/shared/scripts/win-devops-vm-extensions/post-deployment.ps1)

Having said that, for Azure Devops you need to use the AzDevOps REST API, check here: https://learn.microsoft.com/en-us/rest/api/azure/devops/build/source-providers/get-file-contents?view=azure-devops-rest-7.0 and here https://stackoverflow.com/questions/54137998/is-it-possible-to-have-a-link-to-raw-content-of-file-in-azure-devops