Install and remove a program in the same Puppet declaration
I think that the simplest solution is to have the lifecycle of the 7-Zip package managed by exec resources rather than as package resources.  Imagine an exec resource that installs 7-zip, lets call it install-7-zip.  There is also a second puppet exec resource that uninstalls 7-zip, lets call it uninstall-7-zip.
If all of your other puppet resources that need to use 7-zip then require 'install-7-zip' and notify 'uninstall-7-zip' then they will all be actioned whilst the executable is available.
however its not a very puppet way to solve the problem. It means that even if there are no changes required, you will still be running these exec resources, and puppet will think it has changed the platform.
is repackaging the azure pipeline package a possible alternative? perhaps re-zipping it with a different compression setting? or generating a self extracting 7-zip exe instead?