Commit Graph

62 Commits

Author SHA1 Message Date
Azure SDK Bot
5ff89bb9e5
Sync eng/common directory with azure-sdk-tools for PR 2464 (#3206)
* Support AAD graph and Microsoft Graph service principal APIs

* Consolidate service principal wrapper creation

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2022-01-03 16:00:40 -08:00
Azure SDK Bot
e5e637afa3
Ensure ownership grant (#3173)
The focus of these changes is to ensure that the service principal is
explicitly granted the "Owner" role on the active resource group, whether
the principal was newly created or a cached instance was used.

Co-authored-by: Jesse Squire <jesse.squire@gmail.com>
2021-12-09 15:43:15 -05:00
Azure SDK Bot
1ae6ecd0a5
Sync eng/common directory with azure-sdk-tools for PR 2363 (#3159)
* Use stress test environment defaults for group and subscription

* Fix parameter passing from deploy-stress-tests.ps1 script

* Redact stress deployment logs and simplify image handling

* Use DevopsLogging parameter to prevent secret logging in non-devops CI environments

* Use switch type for DevopsLogging parameter

* Remove boolean parameter usage in favor of [switch]

* Add default parameter set usage comment

* Throw when clusterGroup and/or subscription is not specified for custom environments

* Add helper function for logging azure pipelines vso commands

* Invert SuppressVsoCommands binary default value

* Vso command fixes

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2021-12-07 13:45:51 -08:00
Azure SDK Bot
575af58bfb
Restore deploymentOutputs variable in scope for post deployment script (#3153)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2021-12-02 15:01:54 -05:00
Azure SDK Bot
411331d0ec
Sync eng/common directory with azure-sdk-tools for PR 2248 (#3122)
* Exclude certain live test deployment outputs from being marked as log secrets

* debug

* Update subscription configuration merge jobs to use secret handler

* Rename subscription config helper function script

* Fix variable name reference in scope

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2021-12-01 16:11:10 -05:00
Azure SDK Bot
ed842fd92b
Add default cloud configuration values to source (#3099)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2021-11-12 10:36:10 -08:00
Azure SDK Bot
b3bd976866
Sync eng/common directory with azure-sdk-tools for PR 2053 (#3027)
* Changing inline bash for stress test resource deployment

* PR-mod

* pr-mod

* pr-mod

* pr-mod

Co-authored-by: Albert Cheng <albertcheng@microsoft.com>
2021-11-02 23:05:22 -07:00
Azure SDK Bot
e7747b4af9
Skip unnecessary and misleading role assignment warnings in local test resource deployment (#2954)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2021-10-07 13:06:09 -04:00
Azure SDK Bot
e5f190c7a5
Handle multiple segments in service directory path (#2943)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2021-10-05 11:56:45 -07:00
Azure SDK Bot
3e2e5a6dfc
Sync eng/common directory with azure-sdk-tools for PR 1983 (#2860)
* Doc Updates and Revisions for External Use

The focus of these changes is to revise the script to better support use
by external contributors and others outside of the Azure SDK ecosystem and
without access to the Microsoft AAD Tenant.

Changes include:

- Creation of a new Test Application service principal is now possible
  from a non-Microsoft AAD tenant.

- When a new Test Application principal is created, the principle of least
  privilege is now applied; the new Test Application is granted ownership
  of the resource group associated with the test resources and no longer
  has access to any other resources in the subscription.

- If an existing Test Application principal is specified, it will be
  assigned ownership of the resource group created.  This supports using
  a Test Application principal without privileges at the subscription-level.

- When no provisioner is specified, the script is now executed in the
  context of the caller rather than the Test Application principal.
  This supports using a Test Application principal that has restricted
  privileges and better aligns to the purpose of the Test Application
  principal.

- The `$TestApplicationOid` is now explicitly bound at the time a new Test
  Application principal is created rather than having to query for it later.

- Common error scenarios resulting from lack of permissions now provide
  messaging with more context of why the failure occurred and suggest
  remediation.

- Added new examples to illustrate the common call patterns needed by
  external contributors running the script, outside of the Microsoft tenant
  and Azure SDK ecosystem.

- Documentation has been enhanced with additional context to detail the
  permissions and roles assigned by the script.

- Added documentation details for Bicep template use.

* Add the provisioner OID to the deployment params

Key Vault needs this to deploy Managed HSMs. There's a corresponding change necessary in test-resources.json I'll roll out across languages.

* Fixing typos and spelling mistakes

Co-authored-by: Jesse Squire <jesse.squire@gmail.com>
Co-authored-by: Heath Stewart <heaths@microsoft.com>
2021-09-13 09:21:47 -07:00
Azure SDK Bot
bc38afd6ef
Sync eng/common directory with azure-sdk-tools for PR 1953 (#2814)
* Add random elements to default base name

* Fix principal

* tab

Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
2021-08-30 17:45:51 -07:00
Azure SDK Bot
0758a43000
Sync eng/common directory with azure-sdk-tools for PR 1943 (#2810)
* Bug fix: Storing .env file for bicep file at service dir

* Styling

Co-authored-by: Albert Cheng <albertcheng@microsoft.com>
2021-08-27 16:05:33 -07:00
Azure SDK Bot
2ef96b0b72
ensure test principal creation succeeds properly (#2807)
Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com>
2021-08-27 20:59:54 +00:00
Azure SDK Bot
8a2c551230
Sync eng/common directory with azure-sdk-tools for PR 1912 (#2767)
* Attempt to purge all vaults, managed HSMs

Reverts #1910. Vaults and managed HSMs are automatically purged on their purge date. The point was to purge them daily to preserve capacity. The default purge date is +90 days.

* Add timeout and more logging

* Pass required -Resource

* Fix log message

* Ensure the $Resource is correctly captured

Added comment to new code explaining why, since ScriptBlock.GetNewClosure() is not working as expected.

* Add -ErrorAction to Receive-Job

Worked without terminating when run locally, but failed on the first error in the AzDO agent.

* Use $using:r instead of creating ScriptBlock

More idiomatic for passing ScriptBlocks to jobs.

* Resolve PR feedback

* Change default DeleteAfterHours to 120

Resolves #1917

* Use the Az cmdlets built-in -AsJob

Co-authored-by: Heath Stewart <heaths@microsoft.com>
2021-08-18 13:23:31 -07:00
Azure SDK Bot
45e48d3be5
Fix resource clean-up script (#2747)
- 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>
2021-08-13 16:03:04 -07:00
Azure SDK Bot
531c7df24d
Sync eng/common directory with azure-sdk-tools for PR 1876 (#2742)
* rebase

* Resolve conflict

Co-authored-by: Albert Cheng <albertcheng@microsoft.com>
2021-08-13 11:08:31 -07:00
Azure SDK Bot
c92b095088
Sync eng/common directory with azure-sdk-tools for PR 1894 (#2743)
* Purge Key Vaults after deleting resource group

* Resolve PR feedback

* Purge Key Vaults and Managed HSMs

* Clean up all purgeable KVs and MHSMs

* Ignore null/empty purgeable resources

* Resolve PR feedback

* Resolve PR feedback

* Fix logging, process each item when collection piped

Co-authored-by: Heath Stewart <heaths@microsoft.com>
2021-08-12 19:50:53 -07:00
Azure SDK Bot
fe54edf017
Sync eng/common directory with azure-sdk-tools for PR 1767 (#2554)
* Support building and deploying bicep templates

* Add bicep powershell install aka link to deployment error message

* Write bicep compiled arm templates to temp directory

* Simplify bicep building code/function usage

* Use bicep location for compiled arm templates, and remove them on success

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2021-07-07 15:13:54 -04:00
Azure SDK Bot
5e071a07d7
Enable Caching of PS Modules (#2363)
- Remove copied AzPowershell utilities
- Add latest AZ module path already on hosted agents to PSModulePath
- Rename setup-az-modules template setup-environments to reflect what is is doing
- Add support for Caching the current user PS Module folder
- Add support for install-module if not already present in module folder
- Organize the live test clean-up script to be in the standard location

Co-authored-by: Wes Haggard <Wes.Haggard@microsoft.com>
2021-05-27 19:04:12 -04:00
Azure SDK Bot
d3d4fdfe2a
Use underscore-prefixed variable name when setting sub config values as secrets (#2134)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2021-04-19 14:43:09 -07:00
Azure SDK Bot
760026715a
Sync eng/common directory with azure-sdk-tools for PR 1560 (#2133)
* Add template to merge multiple subscription configurations

* Update eng/common/TestResources/build-test-resource-config.yml

Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
Co-authored-by: Ben Broderick Phillips <ben@benbp.net>
Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>
2021-04-19 11:00:40 -07:00
Azure SDK Bot
14cc77a963
Sync eng/common directory with azure-sdk-tools for PR 1548 (#2098)
* 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>
2021-04-09 18:10:44 -07:00
Azure SDK Bot
1ab49d17d0
Fix BaseName initialization (#2096)
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>
2021-04-09 13:32:50 -07:00
Azure SDK Bot
0c1ec5c69e
Sync eng/common directory with azure-sdk-tools for PR 1525 (#2015)
* 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>
2021-04-01 09:39:24 -07:00
Azure SDK Bot
fcbaf7301c
Sync eng/common directory with azure-sdk-tools repository (#2014) 2021-03-31 11:19:45 -07:00
Azure SDK Bot
ab0a92ce62
Sync eng/common directory with azure-sdk-tools for PR 1408 (#1683)
* Improve TestResources docs and logging

Resolves #1388
Resolves #1407

Also ignores cached service principal if it no longer exists. I ran into this while testing since I cleaned up old SPs.

* Add ADP test sub to look-up

Co-authored-by: Heath Stewart <heaths@microsoft.com>
2021-02-12 19:08:11 -08:00
Azure SDK Bot
d76cdf4c6d
Allow logging into specific subscription (#1681)
Resolves #1404

Co-authored-by: Heath Stewart <heaths@microsoft.com>
2021-02-12 12:29:16 -08:00
Azure SDK Bot
3d668eeccf
Sync eng/common directory with azure-sdk-tools for PR 1351 (#1533)
* tweaks to New-TestResources readme
2021-02-01 09:36:50 -06:00
Azure SDK Bot
c9258ee33f
Sync eng/common directory with azure-sdk-tools for PR 1210 (#984)
* Cache created service principal for iteration

Useful when testing changes over and over again without passing your own -TestApplicationId and -TestApplicationSecret.

* Restore initial AzContext for New-TestResources

* Make sure PSBoundParameters is correct

Fixes #1177

Co-authored-by: Heath Stewart <heaths@microsoft.com>
2020-11-16 13:42:08 -08:00
Azure SDK Bot
941d33fe90
Sync eng/common directory with azure-sdk-tools for PR 1202 (#970)
* Add debugging link on resource deployment failures to log output

* Update aka link for live test help docs. Use here string and empty throw.

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2020-11-12 17:31:23 -08:00
Azure SDK Bot
de005643ce
Change live test resource DeleteAfterHours tag to 8 hours (#969)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2020-11-12 13:57:03 -08:00
Azure SDK Bot
2ce6e28eb0
Remove invalid characters in basename sourced from username (#948)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2020-11-11 13:53:23 -08:00
Azure SDK Bot
44cfd6c1dd
Sync eng/common directory with azure-sdk-tools for PR 1188 (#947)
* Add debug flag to arm deployment command

* Only set debug preference when $CI is true

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2020-11-11 13:35:57 -08:00
Azure SDK Bot
038d02fd50
Sync eng/common directory with azure-sdk-tools for PR 1163 (#919)
* 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>
2020-11-09 20:49:45 -05:00
Azure SDK Bot
088a4c85db
Make sure we always log in as app or provisioner (#908)
This also adds previously-required parameters back into
@PSBoundParameters to pass down to pre- and post-scripts.

Co-authored-by: Heath Stewart <heaths@microsoft.com>
2020-11-06 10:03:07 -08:00
Azure SDK Bot
814a7b9203
Sync eng/common directory with azure-sdk-tools for PR 1146 (#873)
* 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>
2020-10-29 19:25:21 -04:00
Azure SDK Bot
7f46381cdd
Sync eng/common directory with azure-sdk-tools repository (#859) 2020-10-26 17:55:27 -07:00
Azure SDK Bot
7ce2d3e57c
Use pre-installed Azure PowerShell modules (#853)
Co-authored-by: Mike Harder <mharder@microsoft.com>
2020-10-26 13:34:48 -07:00
Azure SDK Bot
07c7293276
Sync eng/common directory with azure-sdk-tools for PR 1135 (#848)
* Add check of http link.

* Fixed the tool http link

Co-authored-by: Sima Zhu <sizhu@microsoft.com>
2020-10-23 17:49:01 -07:00
Azure SDK Bot
2f10cdf30b
Update New-TestResources.ps1 parameter documentation to match defaults (#832)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2020-10-22 17:24:48 -04:00
Azure SDK Bot
e3503f8575
Support env vars with hyphens when printing output (#720)
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
2020-10-09 11:56:41 -07:00
Azure SDK Bot
453545afd6
Sync eng/common directory with azure-sdk-tools for PR 1077 (#711)
* Simplify Net-TestResources usage

* docs and windows check

* Update eng/common/TestResources/New-TestResources.ps1

Co-authored-by: Heath Stewart <heaths@outlook.com>

* update markdown

* make service directory the default parameter

* Fix links

* Doc change

Co-authored-by: Pavel Krymets <pavel@krymets.com>
Co-authored-by: Heath Stewart <heaths@outlook.com>
2020-10-08 10:53:54 -07:00
Azure SDK Bot
50376590d9
Sync eng/common directory with azure-sdk-tools repository for Tools PR 1032 (#675) 2020-09-30 11:42:51 -07:00
Azure SDK Bot
1490f38953
Sync eng/common directory with azure-sdk-tools repository for Tools PR 1029 (#674) 2020-09-24 16:37:21 -07:00
Azure SDK Bot
928b0a2da2
Sync eng/common directory with azure-sdk-tools repository for Tools PR 895 (#619) 2020-09-16 12:00:28 -07:00
Azure SDK Bot
4e9efce5f4
Sync eng/common directory with azure-sdk-tools repository for Tools PR https://github.com/Azure/azure-sdk-tools/pull/850 (#490) 2020-08-24 14:11:57 -07:00
Azure SDK Bot
f649bf717a
Sync eng/common directory with azure-sdk-tools repository (#480) 2020-08-18 12:04:46 -07:00
Azure SDK Bot
fe7af14c84
Sync eng/common directory with azure-sdk-tools repository (#363) 2020-07-31 15:53:45 -07:00
Azure SDK Bot
2d507e7e4a
Sync eng/common directory with azure-sdk-tools repository (#251)
Co-authored-by: Daniel Jurek <djurek@microsoft.com>
2020-07-28 11:56:52 -07:00
Azure SDK Bot
de6d6431d8
Sync eng/common directory with azure-sdk-tools repository (#170) 2020-06-15 11:37:39 -07:00