* Support writing .env files from Test Resources
If a language repo opts into it *and* if a `test-resources.bicep` file exists and lints clean of writing secrets *and* if the `.env` file is gitignore'd, write a `.env` file next to `test-resources.bicep`.
* Resolve PR feedback
* Pass -Force for . hidden files on non-Windows
---------
Co-authored-by: Heath Stewart <heaths@microsoft.com>
* Set storage account test resources to disable blob public access
* Skip adding network rules to storage accounts that don't need them during cleanup
* Add succeeded check to set pipeline subnet info step
* Disable network firewall by default in resource creation/removal
---------
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
* Support storage network access and worm removal in remove test resources script
* Move storage network access script to common resource helpers file
* Improve storage container deletion resilience
* Plumb through pool variable to live test cleanup template
* Add sleep for network rule application
---------
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
* Add support for Federated Auth to test resources scripts
* Default -- UseFederatedAuth: false
* Clear secrets if FederatedAuth is set
* Template conditions use AzurePowerShell only when a service connection is needed
* Review feedback and pair with Ben
* Update docs
* http:// -> https://
---------
Co-authored-by: Daniel Jurek <djurek@microsoft.com>
* Consolidate naming logic and generate short hash names for local use
* Shorten long lines
* Handle issues with EnvironmentVariable parameter ref being updated
* Warn on env variable overwrite. Base name generation off resource group
* Use SHA256 algorithm for short name hash
---------
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
* Do not fail remove test resources step when env var is not set.
* Handle empty service directories in remove test resources script
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
* Infer live resource group name based on service directory name
* Simplify service directory path splitting
* Use common logic for username and basename generation
* Rename GetServiceName to GetServiceLeafDirectoryName
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
- Fix rg.Name to rg.ResourceGroupName
- Add more verbose logging for better debugging
- Handle deleted resource groups when gathering puragable resource
- Remove coerce now that we are collecting in functions
Co-authored-by: Wes Haggard <Wes.Haggard@microsoft.com>
* Remove passing -Mode Complete to deployment
When passing Complete it will remove any resources
already in the resource group that weren't part
of the current deployment. That removal breaks a
lot of assumptions, like multiple deployments when
testing things like smoke-tests or if you are reusing
an existing resource group. We don't want that to happen.
* Remove ServiceDirectory as required parameter for remove/update
When this was made mandatory it broke some usages which didn't
pass the value. Those usages don't need to pass it because
the pass required information in other ways so removing the
requirement for the parameter to be passed.
Co-authored-by: Wes Haggard <Wes.Haggard@microsoft.com>
Initializing the BaseName with a ServiceDirectory that contains
a "/", because it is a multiple level path, causes the BaseName
initialization code to fail because it doesn't support the
validation pattern.
In all the known cases we already pass the ResourceGroupName
explicitly so don't need to set the BaseName so we can
skip the initialization in those cases.
Co-authored-by: Wes Haggard <Wes.Haggard@microsoft.com>
* Use SubscriptionId throughout TestResources
Fixes#1454
* Resolve PR feedback
* Default DeleteAfterHours to 48 for SDK team
Also makes a few other adjustments for subscriptions, like restoring the previous one if available and another was specified.
* Resolve PR feedback
* Change deployment mode to Complete
Also fixes an issue where if the user opted not to deploy to the same resource group, the script would continue execution anyway.
* Use consistent aka links to satisfy link checker
Only need it for the new Update-TestResources.ps1 script, but I wanted them to look consistent.
Co-authored-by: Heath Stewart <heaths@microsoft.com>
* Update subscription configuration schema to include new parameters
* Support platform specific arm template parameters and legacy hashtable format
* Update arm template parameter comment to include top level key
* Restore AdditionalParameters. Merge ArmTemplateParameters from stringified hash literal
* Handle duplicate keys more explicitly for arm and env vars
* Regenerate New-TestResources.ps1 markdown
* revert variable name to environmentVariables to fix post-scripts
* Handle empty arm template parameters better
* Remove arm template parameter merge logic from deploy template
* Add merge hashes function to New-TestResources.ps1
* Add merge hashes function to New-TestResources.ps1
* Add env variable overwrite warning. Use ContainsKey checks
* Temporarily manually fix invalid generated markdown links
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
* Remove resource group asynchronously and do not wait for completion
* Verify resource group has reached Deleting state before exiting script
* Use $_ instead of $Error[0] for resource group removal handling
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>