I use Playwright for testing in .NET with Azure DevOps. A CI pipeline performs builds. A CD pipeline deploys our product and runs the tests.
Playwright needs the browser binaries available in
%USERPROFILE%\AppData\Local\ms-playwright The documentation says to run
bin\Debug\netX\playwright.ps1 install to download them. In my case
playwright.ps1 did not exist and test were unable to run. I solved it in my CI pipeline like this.
- task: PowerShell@2
displayName: Download Playwright Browsers
cd <directory with the playwright .csproj>
dotnet tool install --global Microsoft.Playwright.CLI
build remaining projects, code analysis etc. etc.
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
This creates the script, downloads the browsers and includes the script into the build artifact for other stages and pipelines.
If your CD pipeline uses different machines or users, you need to run
playwright.ps1 install in the CD pipeline before starting tests.
Are you unable to delete storage accounts, containers and VHDs in the azure portal? Even when you’ve already deleted the relevant Virtual Machines?
Maybe you’re running into the case that some of your VHDs are still configured as an potential disk for some Virtual Machine. Azure will place a lease on the VHDs in order to avoid accidental deletion.
On https://portal.azure.portal.com, you can’t see these configured disks. On https://manage.windowsazure.com/ you can though.
Go to the ‘Virtual Machines’ item and click in the ‘Disks’ tab at the top of the page. There you see and delete these configured disks
When experimenting in my lab environment I want to create a backup of the virtual machines. The following PowerShell script will do just that. I assume you’ve already setup your PowerShell to work with azure by doing the following:
- Setup the Azure PowerShell cmdlets (see: http://azure.microsoft.com/en-us/downloads/)
- imported your Publish Settings File (see Get-AzurePublishSettingsFile and Import-AzurePublishSettingsFile)
- Defined which storageaccount to use with Set-AzureStorageAccount
- Shutdown all the Virtual Machines
Import-Module Azure -ErrorAction Stop
$backupContainerName = "backups"
$vms = Get-AzureVM
if (! (Get-AzureStorageContainer -Name $backupContainerName -ErrorAction SilentlyContinue) )
New-AzureStorageContainer -Name $backupContainerName -Permission Off
foreach ($vm in $vms)
Write-Host "backing up machine: " $vm.Name
$disks = @()
$disks += $vm | Get-AzureOSDisk
$disks += $vm | Get-AzureDataDisk
foreach($disk in $disks)
$DiskBlobName = $disk.MediaLink.Segments[-1]
$DiskContainerName = $disk.MediaLink.Segments[-2].Split('/')
Write-Host "disk: " $disk.DiskName
#Start an asynchronous copy of the VHD to our backup destination
Start-AzureStorageBlobCopy -SrcContainer $DiskContainerName -SrcBlob $DiskBlobName -DestContainer $backupContainerName -DestBlob $DiskBlobName
#Wait for the copy to complete
Get-AzureStorageBlobCopyState -Blob $DiskBlobName -Container $DiskContainerName -WaitForComplete