I want to add/delete/edit IIS, asp.net core website environment variables in an automated way through appcmd/batch file or PowerShell script, not only one website's variable but on bulk operation. although I can do this one by using IIS UI
Although I can add environment variable by using appcmd
appcmd.exe reset config "variable" -section:system.webServer/aspNetCore /+"environmentVariables.[name='foo',value='bar']"
I could not find a way for add/delete/update multiple websites environment values by just clicking single button instead of going each website's configuration setting to set multiple values, After that I can use that inline script in Azure DevOps pipeline

You can write multiple powershell into a file and execute it. Here is an example for reference.
Create a file and named "xxx.ps1".
Write multiple powershell statements.
Edit and remove enironment value
Open powershell to execute the file(file's path + name).