Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
eeb111a
I am so tired
bwateratmsft Oct 21, 2025
b2ff8f0
Make an `AzureAccount` type shortcut
bwateratmsft Oct 21, 2025
8b62291
Refactor out the cache and filter bits
bwateratmsft Oct 21, 2025
42b80e7
Whitespace
bwateratmsft Oct 22, 2025
6c3d34e
Narrower cache clearing
bwateratmsft Oct 22, 2025
f0a403e
Parallel!
bwateratmsft Oct 22, 2025
f0b7798
Because reasons
bwateratmsft Oct 22, 2025
61334d4
Comment
bwateratmsft Oct 22, 2025
e19173f
Less newlines
bwateratmsft Oct 22, 2025
f379119
Alphabetize them imports
bwateratmsft Oct 22, 2025
e2eb603
Apply suggestions from self code review
bwateratmsft Oct 23, 2025
bf1f3ba
Some feedback from self-review
bwateratmsft Oct 23, 2025
5af2a30
Export
bwateratmsft Oct 23, 2025
5130d58
Comment
bwateratmsft Oct 23, 2025
d1e04f7
Comment
bwateratmsft Oct 23, 2025
0797ee6
Moar comment
bwateratmsft Oct 23, 2025
edbacca
Merge branch 'main' into bmw/authStuff3
bwateratmsft Oct 23, 2025
5c4a99e
Merge branch 'main' into bmw/authStuff3
bwateratmsft Oct 24, 2025
de56f18
Merge branch 'main' into bmw/authStuff3
bwateratmsft Oct 24, 2025
392b6a3
Bump version and freshen up README
bwateratmsft Oct 24, 2025
547fba3
Import order
bwateratmsft Oct 24, 2025
19ad681
Improve `SignInOptions`
bwateratmsft Oct 24, 2025
58190c5
Deparallelize tenant fetch for accounts
bwateratmsft Oct 24, 2025
1809176
Finish comment
bwateratmsft Oct 24, 2025
51147f6
Better logging
bwateratmsft Oct 24, 2025
7735171
Reparallelize now that bug is fixed
bwateratmsft Oct 27, 2025
5555893
Logging refactoring
bwateratmsft Oct 27, 2025
7bb9fd2
Impl and test display name screening
bwateratmsft Oct 27, 2025
b32a44f
Important comment
bwateratmsft Oct 27, 2025
f3e5256
Import types
bwateratmsft Oct 27, 2025
650b3c4
Commentary
bwateratmsft Oct 27, 2025
73113d3
More commentary
bwateratmsft Oct 27, 2025
84a1a0c
Still more commentary
bwateratmsft Oct 27, 2025
50aca3b
Update minimum engine to reflect necessary fix of auth issue
bwateratmsft Oct 27, 2025
0f89141
`setImmediate` instead of `setTimeout`
bwateratmsft Oct 27, 2025
ea7b0fb
Merge branch 'main' into bmw/authStuff3
bwateratmsft Oct 27, 2025
82e5c12
Permit sign in to no particular account
bwateratmsft Oct 27, 2025
f77a25b
Rename method
bwateratmsft Oct 27, 2025
54488a5
Add reason for refresh event
bwateratmsft Oct 28, 2025
494b6aa
Support refresh reason, and subclass override
bwateratmsft Oct 28, 2025
4e63fea
Override to include config listener
bwateratmsft Oct 28, 2025
a564193
Allow signInToTenant without specifying account
bwateratmsft Oct 28, 2025
2d0d3e7
Misc improvements
bwateratmsft Oct 28, 2025
edafeb1
Use a map for account cache so we don't get dupes
bwateratmsft Oct 28, 2025
d5a3d8e
Log when checking unauthenticated tenants
bwateratmsft Oct 28, 2025
eb247ae
More logging
bwateratmsft Oct 28, 2025
d2c844a
Silence before getAccounts
bwateratmsft Oct 28, 2025
478bf90
Fix event spam
bwateratmsft Oct 28, 2025
9f75d28
A todo
bwateratmsft Oct 28, 2025
24159b8
Get token exp
bwateratmsft Oct 28, 2025
eb21803
Allow multiple listeners
bwateratmsft Oct 28, 2025
3890675
Easier reading
bwateratmsft Oct 28, 2025
fcd9e14
Add todo
bwateratmsft Oct 28, 2025
012f0b0
Alpha tagging
bwateratmsft Oct 29, 2025
3c83ef3
Merge branch 'main' into bmw/authStuff3
bwateratmsft Oct 29, 2025
684cc8b
Copilot feedback
bwateratmsft Oct 29, 2025
3eca205
Copilot feedback
bwateratmsft Oct 29, 2025
0107ab8
Move silence refresh
bwateratmsft Oct 29, 2025
6535f9d
Moar parallel
bwateratmsft Oct 29, 2025
89af3ac
Filter dedupe
bwateratmsft Oct 29, 2025
6684d85
Make `getSubscriptionClient` protected
bwateratmsft Oct 30, 2025
d27be87
Update `@azure/identity` and remove others we stopped directly using
bwateratmsft Oct 30, 2025
25a5d4e
Use `AzurePipelinesCredential` instead of our custom thing
bwateratmsft Oct 30, 2025
6bc2f08
Slight refactoring
bwateratmsft Oct 30, 2025
56e410c
Okay well I guess not then, fine
bwateratmsft Oct 30, 2025
f333178
Split out import for azdo provider
bwateratmsft Oct 30, 2025
0f6ef12
You know what...NO!
bwateratmsft Oct 30, 2025
71a75e2
Oops don't export that
bwateratmsft Oct 30, 2025
1f15dca
Merge branch 'main' into bmw/authStuff3
bwateratmsft Nov 12, 2025
c95bfa3
Make refresh event an object with more info
bwateratmsft Nov 12, 2025
df1c4a8
Merge branch 'main' into bmw/authStuff3
bwateratmsft Nov 12, 2025
d0c6794
Use new `idToken` optional
bwateratmsft Nov 12, 2025
f67814a
Update
bwateratmsft Nov 12, 2025
150f31f
Slightly betterer
bwateratmsft Nov 12, 2025
6e39bbe
Refactor options
bwateratmsft Nov 13, 2025
ea4e08c
Add max tenants
bwateratmsft Nov 13, 2025
1f4671b
Flip all => filter
bwateratmsft Nov 13, 2025
76b0656
More docs
bwateratmsft Nov 13, 2025
2a44a90
Don't even fix the typos
bwateratmsft Nov 13, 2025
488c31d
Update auth/src/contracts/AzureSubscriptionProviderRequestOptions.ts
bwateratmsft Nov 13, 2025
55f1a1a
Update auth/src/providers/AzureSubscriptionProviderBase.ts
bwateratmsft Nov 13, 2025
70572eb
Copilot fix
bwateratmsft Nov 13, 2025
7a90289
Merge branch 'bmw/authStuff3' of https://github.com/microsoft/vscode-…
bwateratmsft Nov 13, 2025
b835690
Handle cancellation more thoroughly
bwateratmsft Nov 13, 2025
a53066c
Some extra todos
bwateratmsft Nov 13, 2025
694e014
Address one todo
bwateratmsft Nov 13, 2025
d893c64
Comment out to silence build error
bwateratmsft Nov 13, 2025
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
80 changes: 5 additions & 75 deletions auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,79 +4,9 @@ This package provides a simple way to authenticate to Azure and receive Azure su

## Azure Subscription Provider

The `AzureSubscriptionProvider` interface describes the functions of this package.
The [`AzureSubscriptionProvider`](./src/contracts/AzureSubscriptionProvider.ts) interface describes the functions of this package.

```typescript
/**
* An interface for obtaining Azure subscription information
*/
export interface AzureSubscriptionProvider {
/**
* Gets a list of tenants available to the user.
* Use {@link isSignedIn} to check if the user is signed in to a particular tenant.
*
* @returns A list of tenants.
*/
getTenants(): Promise<TenantIdDescription[]>;

/**
* Gets a list of Azure subscriptions available to the user.
*
* @param filter - Whether to filter the list returned. When:
* - `true`: according to the list returned by `getTenantFilters()` and `getSubscriptionFilters()`.
* - `false`: return all subscriptions.
* - `GetSubscriptionsFilter`: according to the values in the filter.
*
* Optional, default true.
*
* @returns A list of Azure subscriptions.
*
* @throws A {@link NotSignedInError} If the user is not signed in to Azure.
* Use {@link isSignedIn} and/or {@link signIn} before this method to ensure
* the user is signed in.
*/
getSubscriptions(filter: boolean): Promise<AzureSubscription[]>;

/**
* Checks to see if a user is signed in.
*
* @param tenantId (Optional) Provide to check if a user is signed in to a specific tenant.
*
* @returns True if the user is signed in, false otherwise.
*/
isSignedIn(tenantId?: string): Promise<boolean>;

/**
* Asks the user to sign in or pick an account to use.
*
* @param tenantId (Optional) Provide to sign in to a specific tenant.
*
* @returns True if the user is signed in, false otherwise.
*/
signIn(tenantId?: string): Promise<boolean>;

/**
* An event that is fired when the user signs in. Debounced to fire at most once every 5 seconds.
*/
onDidSignIn: vscode.Event<void>;

/**
* Signs the user out
*
* @deprecated Not currently supported by VS Code auth providers
*
* @throws Throws an {@link Error} every time
*/
signOut(): Promise<void>;

/**
* An event that is fired when the user signs out. Debounced to fire at most once every 5 seconds.
*/
onDidSignOut: vscode.Event<void>;
}
```

If the caller calls `getSubscriptions()` when the user is not signed in, a `NotSignedInError` will be thrown. You can check to see if a caught error is an instance of this error with `isNotSignedInError()`.
If the caller calls `getAvailableSubscriptions()` or `getAccounts()` when the user is not signed in, a `NotSignedInError` will be thrown. You can check to see if a caught error is an instance of this error with `isNotSignedInError()`.

## Azure Cloud Configuration
Two methods are available for controlling the VSCode settings that determine what cloud is connected to when enumerating subscriptions.
Expand Down Expand Up @@ -104,7 +34,7 @@ export declare function setConfiguredAzureEnv(cloud: string | azureEnv.Environme

## Azure DevOps Subscription Provider

The auth package also exports `AzureDevOpsSubscriptionProvider`, a class which implements the `AzureSubscriptionProvider` interface, which authenticates via
The auth package also exports [`AzureDevOpsSubscriptionProvider`](./src/providers/AzureDevOpsSubscriptionProvider.ts), a class which implements the `AzureSubscriptionProvider` interface, which authenticates via
a federated Azure DevOps service connection, using [workflow identity federation](https://learn.microsoft.com/entra/workload-id/workload-identity-federation).

This provider only works when running in the context of an Azure DevOps pipeline. It can be used to run end-to-end tests that require authentication to Azure,
Expand Down Expand Up @@ -135,9 +65,9 @@ if (!signedIn) {
throw new Error("Couldn't sign in");
}

const subscriptions = await subscriptionProvider.getSubscriptions();
const subscriptions = await subscriptionProvider.getAvailableSubscriptions();

// logic on the subscriptions object
// logic on the subscriptions objects
```

For more detailed steps on how to setup your Azure environment to use workflow identity federation and use this `AzureDevOpsSubscriptionProvider` object effectively,
Expand Down
Loading