From 7419b8f85d645dd422ea690437c3db922bd80261 Mon Sep 17 00:00:00 2001 From: Jeffrey Shen Date: Sun, 8 Nov 2020 15:38:51 +1100 Subject: [PATCH 1/2] Fix invalid resource uri in REST call thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Azure("AuthorizationError(Failed to authenticate to Azure Active Directory Caused by: Generic error: AADSTS70011: The provided request must include a \'scope\' input parameter. The provided value for the input parameter \'scope\' is not valid. The scope https://vault.azure.net.default is not valid --- sdk/key_vault/src/client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/key_vault/src/client.rs b/sdk/key_vault/src/client.rs index 5b2a1d3780..64225e2a64 100644 --- a/sdk/key_vault/src/client.rs +++ b/sdk/key_vault/src/client.rs @@ -75,7 +75,7 @@ impl<'a, T: TokenCredential> KeyVaultClient<'a, T> { // Token is valid, return it. return Ok(()); } - let resource = format!("https://{}", &self.endpoint_suffix); + let resource = format!("https://{}/", &self.endpoint_suffix); let token = self .token_credential .get_token(&resource) From 767521bafbd69e9dea8e212b73dab5f78864aa66 Mon Sep 17 00:00:00 2001 From: numbers Date: Tue, 10 Nov 2020 03:24:30 +0000 Subject: [PATCH 2/2] Be more tolerant w/ setting the endpoint resource url --- sdk/key_vault/src/client.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sdk/key_vault/src/client.rs b/sdk/key_vault/src/client.rs index 64225e2a64..63e37166c8 100644 --- a/sdk/key_vault/src/client.rs +++ b/sdk/key_vault/src/client.rs @@ -75,7 +75,12 @@ impl<'a, T: TokenCredential> KeyVaultClient<'a, T> { // Token is valid, return it. return Ok(()); } - let resource = format!("https://{}/", &self.endpoint_suffix); + + let mut resource = format!("https://{}", &self.endpoint_suffix); + if !self.endpoint_suffix.ends_with("/") { + resource.push_str("/"); + } + let token = self .token_credential .get_token(&resource)