Created
November 19, 2021 23:18
-
-
Save isaacrlevin/aaf31ddc42de5f780e03377498280119 to your computer and use it in GitHub Desktop.
Azure SDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var credential = new AzureCliCredential(); | |
ArmClient armClient = new ArmClient(credential); | |
var subscriptions = armClient.GetSubscriptions(); | |
var sub = subscriptions.Where(a => a.Data.SubscriptionGuid == mySubId).FirstOrDefault(); | |
var creds = new AzureIdentityFluentCredentialAdapter(sub.Data.TenantId, AzureEnvironment.AzureGlobalCloud); | |
// fails here | |
var websites = await Azure.Authenticate(creds) | |
.WithSubscription(sub.Data.DisplayName) | |
.WebApps.ListByResourceGroupAsync(rgName); |
That doesn't seem to work either. If you have a preferred sample, I will gladly take that.
Tried the code you put in that gist... Still didn't work
Isaac
…On Fri, Nov 19, 2021 at 3:36 PM Jon Gallant ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Why are you using Fluent libs? You should have everything you need with
the new libs.
https://azure.github.io/azure-sdk/releases/latest/mgmt/dotnet.html
Try passing credential to AzureIdentityFluentCredentialAdapter
var credential = new AzureCliCredential();ArmClient armClient = new ArmClient(credential);var subscriptions = armClient.GetSubscriptions();var sub = subscriptions.Where(a => a.Data.SubscriptionGuid == mySubId).FirstOrDefault();var creds = new AzureIdentityFluentCredentialAdapter(credential, sub.Data.TenantId, AzureEnvironment.AzureGlobalCloud);
// fails herevar websites = await Azure.Authenticate(creds)
.WithSubscription(sub.Data.DisplayName)
.WebApps.ListByResourceGroupAsync(rgName);
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/aaf31ddc42de5f780e03377498280119#gistcomment-3968446>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACDXTJVO6WLIIGO5ARET6YTUM3NQHANCNFSM5INHJV2Q>
.
I figured it out... it seems the SDK was swallowing a different error but I
got past it. Thanks
…On Mon, Nov 22, 2021 at 8:44 AM Isaac Levin ***@***.***> wrote:
Tried the code you put in that gist... Still didn't work
Isaac
On Fri, Nov 19, 2021 at 3:36 PM Jon Gallant ***@***.***>
wrote:
> ***@***.**** commented on this gist.
> ------------------------------
>
> Why are you using Fluent libs? You should have everything you need with
> the new libs.
> https://azure.github.io/azure-sdk/releases/latest/mgmt/dotnet.html
>
> Try passing credential to AzureIdentityFluentCredentialAdapter
>
> var credential = new AzureCliCredential();ArmClient armClient = new ArmClient(credential);var subscriptions = armClient.GetSubscriptions();var sub = subscriptions.Where(a => a.Data.SubscriptionGuid == mySubId).FirstOrDefault();var creds = new AzureIdentityFluentCredentialAdapter(credential, sub.Data.TenantId, AzureEnvironment.AzureGlobalCloud);
> // fails herevar websites = await Azure.Authenticate(creds)
> .WithSubscription(sub.Data.DisplayName)
> .WebApps.ListByResourceGroupAsync(rgName);
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://gist.github.com/aaf31ddc42de5f780e03377498280119#gistcomment-3968446>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ACDXTJVO6WLIIGO5ARET6YTUM3NQHANCNFSM5INHJV2Q>
> .
>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why are you using Fluent libs? You should have everything you need with the new libs. https://azure.github.io/azure-sdk/releases/latest/mgmt/dotnet.html
Try passing credential to AzureIdentityFluentCredentialAdapter