Another way would be to use azure keyvault. Add your env variables to the azure keyvault -> Fetch them using az cli commands and add them a .env file through the pipiline itself.
You can also add a set to remove the .env from the pipeline once the usage is met.