marianleica / azrez

Azure Resource Launcher (azrez) is a console application, created by @marianleica, that aims to support those looking for quick deployments in Azure VMs and Kubernetes for learning and swift repros.
https://github.com/marianleica/azrez
MIT License
1 stars 0 forks source link

Azrez environmental variable #12

Closed Andu1391 closed 3 weeks ago

Andu1391 commented 3 weeks ago

Add to environment variables

$env:Path += ";C:\azrez\"

Does not add the environmental variable, leading to a cmdlet failure when running azrez.

Workaround: Manually adding the variable Or, executing .\azrez.exe from C:\azrez\azrez.exe

marianleica commented 3 weeks ago

Acknowledged in Limitations, will add a disclaimer in the setup script on main page

- The command $env:Path += ";C:\azrez\" only sets env variable in the current terminal session. Workaround for permanent variable is to manually add C:\azrez\ to the Path environment variables in Advanced System Settings

This is by design:

When you change environment variables in PowerShell, the change affects only the current session.
Ref: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.4
To change values in the Machine or User scopes, you must use the methods of the System.Environment class.
Ref: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.4#create-persistent-environment-variables-in-windows

We'll live with it for now