Skip to content

Commit 55bbd4d

Browse files
authored
[Doc][CI] Update docs and test utils (#40534)
- Removed referenced to -UserAuth since that flag no longer exists - Removed VisualStudioCodeCredential as a test credential option. This credential has long been broken and is being deprecated soon. Signed-off-by: Paul Van Eck <[email protected]>
1 parent e71de3e commit 55bbd4d

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

doc/dev/tests.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,12 @@ Live Azure resources will be necessary in order to run live tests and produce re
174174
resource management commands, documented in [/eng/common/TestResources][test_resources], that streamline this process.
175175
Both pure ARM templates (`test-resources.json`) and BICEP files (`test-resources.bicep`) are supported.
176176

177-
User-based authentication is preferred when using test resources. To enable this:
178-
- Use the [`-UserAuth` command flag][user_auth_flag] when running the `New-TestResources` script.
177+
User-based authentication is preferred when using test resources. The `New-TestResources` script defaults to user-based authentication. To use it:
179178
- Choose a development tool to authenticate with by setting an `AZURE_TEST_USE_*_AUTH` environment variable to "true" (tests will authenticate as the tool's logged-in user). The following tools are supported, listed in the order that authentication will be attempted in if requested:
180179
1. Azure PowerShell: set `AZURE_TEST_USE_PWSH_AUTH`.
181180
2. Azure CLI (`az`): set `AZURE_TEST_USE_CLI_AUTH`.
182-
3. Visual Studio Code: set `AZURE_TEST_USE_VSCODE_AUTH`.
183181
4. Azure Developer CLI (`azd`): set `AZURE_TEST_USE_AZD_AUTH`.
184-
- Ensure you're logged into the tool you choose -- if
185-
you used `New-TestResources.ps1` to deploy resources, you'll already have logged in with Azure PowerShell.
182+
- Ensure you're logged into the tool you choose -- if you used `New-TestResources` to deploy resources, you'll already have logged in with Azure PowerShell.
186183

187184
**Important:** these environment variables will only be successfully used if test credentials are fetched with the
188185
[`AzureRecordedTestCase.get_credential`][get_credential] method. See [Write your tests](#write-your-tests) for details.
@@ -215,11 +212,10 @@ environment variables necessary to run live tests for the service. After storing
215212
-- formatted as `VARIABLE=value` on separate lines -- your credentials and test configuration variables will be set in
216213
our environment when running tests.
217214

218-
If you used the [`-UserAuth` command flag][user_auth_flag] to deploy test resources, choose a development tool to
215+
Since `New-TestResources` defaults to user-based authentication, choose a development tool to
219216
authenticate with by setting an `AZURE_TEST_USE_*_AUTH` environment variable to "true". The following tools are supported, listed in the order that authentication will be attempted in if requested:
220217
1. Azure PowerShell: set `AZURE_TEST_USE_PWSH_AUTH`.
221218
2. Azure CLI (`az`): set `AZURE_TEST_USE_CLI_AUTH`.
222-
3. Visual Studio Code: set `AZURE_TEST_USE_VSCODE_AUTH`.
223219
4. Azure Developer CLI (`azd`): set `AZURE_TEST_USE_AZD_AUTH`.
224220

225221
**Important:** these environment variables will only be successfully used if test credentials are fetched with the
@@ -611,4 +607,3 @@ For information about more advanced testing scenarios, refer to the [advanced te
611607
[test_proxy_startup]: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/test_proxy_migration_guide.md#start-the-proxy-server
612608
[test_resources]: https://github.com/Azure/azure-sdk-for-python/tree/main/eng/common/TestResources#readme
613609
[troubleshooting_guide]: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/test_proxy_troubleshooting.md
614-
[user_auth_flag]: https://github.com/Azure/azure-sdk-for-python/blob/main/eng/common/TestResources/New-TestResources.ps1.md#-userauth

tools/azure-sdk-tools/devtools_testutils/azure_recorded_testcase.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ def get_credential(**kwargs):
198198

199199
use_pwsh = os.environ.get("AZURE_TEST_USE_PWSH_AUTH", "false")
200200
use_cli = os.environ.get("AZURE_TEST_USE_CLI_AUTH", "false")
201-
use_vscode = os.environ.get("AZURE_TEST_USE_VSCODE_AUTH", "false")
202201
use_azd = os.environ.get("AZURE_TEST_USE_AZD_AUTH", "false")
203202
is_async = kwargs.pop("is_async", False)
204203

@@ -222,16 +221,6 @@ def get_credential(**kwargs):
222221
if is_async:
223222
from azure.identity.aio import AzureCliCredential
224223
return AzureCliCredential(**kwargs)
225-
# User-based authentication through Visual Studio Code, if requested
226-
if use_vscode.lower() == "true":
227-
_LOGGER.info(
228-
"Environment variable AZURE_TEST_USE_VSCODE_AUTH set to 'true'. Using VisualStudioCodeCredential."
229-
)
230-
from azure.identity import VisualStudioCodeCredential
231-
232-
if is_async:
233-
from azure.identity.aio import VisualStudioCodeCredential
234-
return VisualStudioCodeCredential(**kwargs)
235224
# User-based authentication through Azure Developer CLI (azd), if requested
236225
if use_azd.lower() == "true":
237226
_LOGGER.info(

tools/azure-sdk-tools/devtools_testutils/envvariable_loader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ def _set_mgmt_settings_real_values(self):
6464
if not all(x is not None for x in [tenant, client, secret]):
6565
use_pwsh = os.environ.get("AZURE_TEST_USE_PWSH_AUTH", "false").lower()
6666
use_cli = os.environ.get("AZURE_TEST_USE_CLI_AUTH", "false").lower()
67-
use_vscode = os.environ.get("AZURE_TEST_USE_VSCODE_AUTH", "false").lower()
6867
use_azd = os.environ.get("AZURE_TEST_USE_AZD_AUTH", "false").lower()
69-
user_auth = use_pwsh == "true" or use_cli == "true" or use_vscode == "true" or use_azd == "true"
68+
user_auth = use_pwsh == "true" or use_cli == "true" or use_azd == "true"
7069
if not user_auth:
7170
# All variables are required for service principal authentication
7271
_logger.warn(

0 commit comments

Comments
 (0)