Credential management automation

Initial set of service principal and other login tests.
Also fixes issues with get-azureenvironment and piping (without it the tests don't work)