-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor lab API and remove certificate based auth #5023
base: main
Are you sure you want to change the base?
Conversation
428359c
to
333f687
Compare
333f687
to
95a8a2b
Compare
95a8a2b
to
f5b456d
Compare
// TODO: test this on MacOs / Linux WSL | ||
private static TokenCredential GetAzureCredentialForDevBox() | ||
{ | ||
InteractiveBrowserCredential interactiveBrowserCredential = new InteractiveBrowserCredential( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use VisualStudioCredential
instead?
// Set the Key Vault URL
string keyVaultUrl = "https://msidlabs.vault.azure.net/";
// Create a new Visual Studio Credential
var credential = new VisualStudioCredential();
// Create a new SecretClient using the Visual Studio Credential
var client = new SecretClient(new Uri(keyVaultUrl), credential);
// Retrieve a secret from Azure Key Vault
KeyVaultSecret secret = client.GetSecret("msidlab1");
Console.WriteLine($"Secret: {secret.Value}");
this will use the Azure Service Authentication account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we can't use any of the DefaultAzureCredential options, because there is no option to change the clientID. If you use VSCredentail, it'll use VS clientID.
And VS clientID is not authorized to call MSIDlab.
I was thinking that if we were to directly call the KV that might work though. Maybe not VS client ID, but az cli or some tool might do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VS clientID
is now authorized to call Lab API for an authorized user
@@ -184,7 +171,7 @@ public async Task OBOCiam_CustomDomain_ReturnsValidTokens() | |||
//Acquire tokens for OBO | |||
var msalConfidentialClient = ConfidentialClientApplicationBuilder | |||
.Create(ciamWebApi) | |||
.WithCertificate(CertificateHelper.FindCertificateByName(TestConstants.AutomationTestCertName)) | |||
.WithCertificate(CertificateFinder.FindCertificateByName(TestConstants.AutomationTestCertName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we create a new self signed cert for this purpose? and move away from the SNI cert for lab apps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still makes sense to have a single cert secure all our tests apps.
public class LabApiConstants | ||
public static class LabApiConstants | ||
{ | ||
public const string LabClientId = "f62c5ae3-bf3a-4af5-afa8-a68b800396e9"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we move to use Visual Studio credential for DevBox and UAMI based acccess for CI, we do not need this app flow anymore
Fixes #
Changes proposed in this request
Testing
Performance impact
Documentation