-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add APIs to programatically change Tenant ID and Cloud #805
Comments
CC @isidorn, @binderjoe |
@fjakobs thanks for the ping. fyi @TylerLeonhardt |
The DataBricks extension uses the Azure Account extension for Auth, so I can't help too much here. I'll defer to @bwateratmsft. That said, in the built-in Microsoft auth extension, you can do this with a special scope we introduced. It's something I wanna change in the future for something more supported, but anyway. |
In the near future we plan to deprecate the Azure Account extension in favor of the built-in authentication provider. We intend to create an NPM package that will do essentially the same thing the Azure Account extension is doing, and we'll leave the Azure Account extension available as long as possible (but the ADAL shutdown deadline can't be pushed back forever...). I'll include some control of tenant selection and cloud in that library's design. |
@bwateratmsft Do you have a rough timeline for the library that uses the building authentication provider? I might just wait for that if it is not too far out. |
I'm hoping to get it done in the next month or so. |
Here's the PR, by the way: microsoft/vscode-azuretools#1461 |
@bwateratmsft I see that the PR has been merged. Is it ready for me to try out? Also is there any kind of documentation or an example that I can look at? |
The package is available on NPM, it contains documentation on the (relatively few) methods available. https://www.npmjs.com/package/@microsoft/vscode-azext-azureauth There's a more complex example: microsoft/vscode-azureresourcegroups#707 |
It contains an API for changing the cloud but not tenant. We tried to make it so that when you signed in, all subscriptions across all tenants accessible to that account would be shown. |
A very simple example: import { AzureSubscription, VSCodeAzureSubscriptionProvider } from '@microsoft/vscode-azext-azureauth';
const subscriptionProvider = new VSCodeAzureSubscriptionProvider();
if (!await subscriptionProvider.isSignedIn()) {
await subscriptionProvider.signIn();
}
const subscriptions = await subscriptionProvider.getSubscriptions();
for (const subscription of subscriptions) {
// ...
} |
Fantastic, thanks a lot. |
I got a bit further but now I'm stuck configuring an app ID. For Azure Databricks we need to get a token for the app ID What I need is the equivalent of I've tried
but then I was getting this error when using the Azure Databricks APIs:
|
@TylerLeonhardt is it possible to get a token for a specific app using the auth provider? |
Yeah see this comment: microsoft/vscode#115626 (comment) Basically you wanna do |
@fjakobs can you try that? const session = await subscription.authentication.getSession(['VSCODE_CLIENT_ID:2ff814a6-3304-4ab8-85cb-cd0e6f879c1d']); |
This doesn't work either. When I call
@TylerLeonhardt searching for |
Since your auth case is somewhat specialized you may want to just directly use the Microsoft auth provider, https://code.visualstudio.com/api/references/vscode-api#authentication and https://github.com/microsoft/vscode/tree/main/extensions/microsoft-authentication have some more information on that. |
I think I'm stuck. using the Mircosoft auth directly with this code:
I'm getting Since |
@TylerLeonhardt this is beyond my expertise, do you know how to configure things? |
I was able to get it to work with a bit of hacking with the So in principle it should be possible. |
For the Databricks Extension for VSCode, we would like to have a programmatic way to change the Cloud and the Tenant ID.
We are currently resorting to these hacks:
This kind of works but it's ugly and we have no way to get any feedback if the command succeeded.
The text was updated successfully, but these errors were encountered: