Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Record KV tests
  • Loading branch information
mccoyp committed Feb 14, 2024
commit 51439e92f2196edbd7e0dc319c3b2483f37db977
2 changes: 1 addition & 1 deletion sdk/keyvault/azure-keyvault-keys/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/keyvault/azure-keyvault-keys",
"Tag": "python/keyvault/azure-keyvault-keys_cac2051a50"
"Tag": "python/keyvault/azure-keyvault-keys_7c4c92bba7"
}
16 changes: 12 additions & 4 deletions sdk/keyvault/azure-keyvault-keys/tests/test_challenge_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from azure.core.pipeline import Pipeline
from azure.core.pipeline.policies import SansIOHTTPPolicy
from azure.core.rest import HttpRequest
from azure.identity import ClientSecretCredential
from azure.identity import AzureCliCredential, AzurePowerShellCredential, ClientSecretCredential
from azure.keyvault.keys import KeyClient
from azure.keyvault.keys._shared import ChallengeAuthPolicy, HttpChallenge, HttpChallengeCache
from azure.keyvault.keys._shared.client_base import DEFAULT_VERSION
Expand All @@ -48,9 +48,17 @@ def test_multitenant_authentication(self, client, is_hsm, **kwargs):

# we set up a client for this method to align with the async test, but we actually want to create a new client
# this new client should use a credential with an initially fake tenant ID and still succeed with a real request
credential = ClientSecretCredential(
tenant_id=str(uuid4()), client_id=client_id, client_secret=client_secret, additionally_allowed_tenants="*"
)
if os.environ.get("AZURE_TEST_USE_PWSH_AUTH") == "true":
credential = AzurePowerShellCredential(tenant_id=str(uuid4()), additionally_allowed_tenants="*")
elif os.environ.get("AZURE_TEST_USE_CLI_AUTH") == "true":
credential = AzureCliCredential(tenant_id=str(uuid4()), additionally_allowed_tenants="*")
else:
credential = ClientSecretCredential(
tenant_id=str(uuid4()),
client_id=client_id,
client_secret=client_secret,
additionally_allowed_tenants="*",
)
managed_hsm_url = kwargs.pop("managed_hsm_url", None)
keyvault_url = kwargs.pop("vault_url", None)
vault_url = managed_hsm_url if is_hsm else keyvault_url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from azure.core.pipeline import AsyncPipeline
from azure.core.pipeline.policies import SansIOHTTPPolicy
from azure.core.rest import HttpRequest
from azure.identity.aio import ClientSecretCredential
from azure.identity.aio import AzureCliCredential, AzurePowerShellCredential, ClientSecretCredential
from azure.keyvault.keys._shared import AsyncChallengeAuthPolicy,HttpChallenge, HttpChallengeCache
from azure.keyvault.keys._shared.client_base import DEFAULT_VERSION
from azure.keyvault.keys.aio import KeyClient
Expand Down Expand Up @@ -49,9 +49,17 @@ async def test_multitenant_authentication(self, client, is_hsm, **kwargs):

# we set up a client for this method so it gets awaited, but we actually want to create a new client
# this new client should use a credential with an initially fake tenant ID and still succeed with a real request
credential = ClientSecretCredential(
tenant_id=str(uuid4()), client_id=client_id, client_secret=client_secret, additionally_allowed_tenants="*"
)
if os.environ.get("AZURE_TEST_USE_PWSH_AUTH") == "true":
credential = AzurePowerShellCredential(tenant_id=str(uuid4()), additionally_allowed_tenants="*")
elif os.environ.get("AZURE_TEST_USE_CLI_AUTH") == "true":
credential = AzureCliCredential(tenant_id=str(uuid4()), additionally_allowed_tenants="*")
else:
credential = ClientSecretCredential(
tenant_id=str(uuid4()),
client_id=client_id,
client_secret=client_secret,
additionally_allowed_tenants="*",
)
managed_hsm_url = kwargs.pop("managed_hsm_url", None)
keyvault_url = kwargs.pop("vault_url", None)
vault_url = managed_hsm_url if is_hsm else keyvault_url
Expand Down