How to Azure DevOps pull requests create a temporary environment

Solution 1:

With some scripting in your CI/CD pipeline.

For building, consider Microsoft hosted build agents. Already one use VMs.

For a dynamically created test environment, you will probably have to put together a few pieces. Like pull request triggers in a release pipeline that has an Azure ARM template that deploys the Pipelines agent. Cleaning up might need to get a bit creative, but presumably you can have a stage trigger delete the environment.

Solution 2:

Consider Azure Dev Spaces. Developers can spin up ephemeral environments from visual studio with randomised public URL as easy as running on localhost. Maybe this could fulfill your needs or if not, you might be able to automate spinning up Dev Spaces from the build pipeline used by your check-in gate