It all started with UWP. The [docs](https://docs.microsoft.com/en-us/cpp/cppcx/crt-functions-not-supported-in-universal-windows-platform-apps?view=msvc-170) say: "`Environment variables are not available to UWP apps.`". And it truly won't work, I tried: linker error, the function is simply not present.
So, for a year or so, we were `ifdef`ing everything enivoronment-related: console logger, environment credential, managed identity credential.
And then just recently we wanted to enable our CI for UWP, including tests and samples. And it required to do more ifdefs (in vcpkg, we don't build samples or tests, so that problem did not exist).
It just became more messy. Especially in samples - you can see how we would disable warning with `#pragma warning(disable : 4996)` or defining `_CRT_SECURE_NO_WARNINGS` already, but now came UWP, so we would have to add comment that `getenv()` is not available and make the sample compilation to either fail with clear message, or throw an exception. Plus we would have to detect that we are being compiled on UWP, which also adds visual clutter for reader. You can see how such an irrelevant (for a sample) thing as `getenv` was consuming more and more lines of sample code and reader's attention.
But then! I read docs on more APIs for UWP. And I noticed that on .NET you can read environment variables. So I went and checked Win32 API docs for [GetEnvironmentVariable()](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getenvironmentvariable) - it says: "`Minimum supported client: ... UWP apps`".
**GetEnvironmentVariable() works on UWP!**
And so does `SetEnvironmentVariable()` (our tests use it, which means we can make all of them work and execute for UWP).
That's good news, but now it would probably be more code: it usually takes more lines to invoke WinAPI, it is no more an one-liner to call `getenv()/setenv()`. So, I encapsulated that into `Azure::Core::_internal::Environment::GetVariable()` and `SetVariable()`. You can see how much less ifdefs is in our code now. Not to mention it works on UWP!
Per team request, that API is SDK-internal. Samples use their own mini-helper project, `get-env-helper` that makes is so that `getenv()` works naturally on Linux and macOS, compiles without warnings and works on Win32, and compiles and works on UWP (using `GetEnvironmentStringsA()`)
If it was for me, I would just make `Azure::Core::Environment::GetVariable()` public and simplify even further, I think it would be beneficial for sample readers (you can see that extra `get-env-helper` stuff adds just a little more visual clutter, compared to nothing). But I can see reasons against that, why team did not want to do it.
- Fix bug in Add-ReleaseLease helper script
- Enable better local logging for handling token
- Enable strict mode to help catch issues like this in the future
* prepPR
* gitignore updates
* cspell.json
* spell
* cspell typo
* deisable option
* need to look out for this
* reenable tests
* set unset location properly
* building in docker
* format file
* final changes
* PR comments
* update git ignore
* test cmake build
* test 2
* ren steps
* test new step
* try again
* again
* oops
* try again
* put back
* test2
* test5_46
* progress
* more again
* test6_35
* test 6_55
* test_again
* move up
* test
* output params
* try try again
* one more test
* put back curl
* os
* run only on one
* try again
* typo
* switch variable
* set things back
* set things back
* prep for next step
* test source deps new
* try again
* try try again
* typo
* test rewire
* params
* typo
* fix
* get rid of vcpkg
* linux
* mac
* try brew
* try exports
* try again
* typo
* set env
* include dir
* root
* try again
* typo
* dfsfsda
* try agan
* try again
* oops
* sdfsd
* typo
* dsdsad
* hghhg
* update env
* ghhgj
* sAdsad
* try again
* fdfd
* rewrew
* dsadas
* sdasda
* ggggg
* envs2
* envs3
* typo
* order
* try again
* make sure we don't blow up other pipelines
* typo
* typo
* fsdfs
* check null
* put back
* Update test resources SP password creation to support Az >= 7.1.0
* Check Az.Resources module version
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
* Support AAD graph and Microsoft Graph service principal APIs
* Consolidate service principal wrapper creation
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
* Generate map files in build
* Add .map file artifact publishing
* Add Xlinker to spelling exceptions
* Remove PublishMapFiles from clang builds
* Generate the map file artifact name
* CXX_COMPILER_ID and some logging for Clang which might be linking using the GNU linker by default
* More logging
* Move logging out of conditional
* Logging up high, use OS to determine which link flags to set
* Use linker options specific to AppleClang's context, publish map files for all platforms