[BUG] System.InvalidOperationException: No subscriptions found for the given credentials
See original GitHub issueLibrary name and version
Azure.ResourceManager.Resources 1.0.0-beta.5
Describe the bug
My program reports an error saying that I don’t have subscriptions, but I do have a subscription.
Expected behavior
My program should print the Id of my subscription.
Actual behavior
It reports an error saying that I don’t have subscriptions, but I do have a subscription.
Unhandled exception. System.InvalidOperationException: No subscriptions found for the given credentials
at Azure.ResourceManager.ArmClient.GetDefaultSubscriptionAsync(CancellationToken cancellationToken)
at Program.<Main>$(String[] args) in /home/adrian/temp/AZ-204/consoleApp/Program.cs:line 6
at Program.<Main>(String[] args)
Reproduction Steps
- Create a new console project with
dotnet new console
- Add the following NuGet packages:
- Copy and paste this code:
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Resources;
var armClient = new ArmClient(new InteractiveBrowserCredential());
var subscription = await armClient.GetDefaultSubscriptionAsync();
Console.WriteLine(subscription.Id);
This command demonstrates that I have multiple subscriptions:
$ az account list --all --query '[].{isDefault: isDefault, name: name, state: state}'
[
{
"isDefault": false,
"name": "Pase para Azure: patrocinio",
"state": "Disabled"
},
{
"isDefault": true,
"name": "Pase para Azure: patrocinio",
"state": "Enabled"
}
]
I think the problem must be with InteractiveBrowserCredential
, because when I use DefaultAzureCredential
instead and I execute dotnet run
in the same terminal I executed az login
I get the subscription id without problems.
Environment
$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/6.0.101/
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
.NET SDKs installed:
6.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
I am using WSL. VSCode version: 1.63.2
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:46 (19 by maintainers)
Top Results From Across the Web
No subscriptions found sign in error for Azure portal
Cause. This problem occurs if you selected at the wrong directory, or if your account doesn't have sufficient permissions.
Read more >Azure ArmClient not finding subscriptions for one of my ...
The central issue here is that the my personal user is my normal MS account, which is "external" to the tenant.
Read more >Adding an Azure cloud account fails with the error "Serialized ...
When adding an Azure cloud account, it fails with the the following error: Serialized exception information was not found in the database.
Read more >Help troubleshooting Azure archive (powershell) - Forum
Serialized exception information was not found in the database. Recovered details are: System.InvalidOperationException: Azure resource manager credentials ...
Read more >I am trying to access Azure active directory through ... - Edureka
Every time I try to access the Azure Active directory via portal, it displays a message telling "No subscriptions found".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@christothes It’s a GitHub account actually.
Hi @adriancuadrado - It seems that you are using a Live account, if the tenantId is
F8CDEF31-A31E-4B4A-93E4-5F571E91255A
(live.com tenant id).Are you logging into an AAD tenant in which this live account is guested? If so, the issue is that AAD is defaulting to this live account tenant, and you’ll need to tell it which tenantId you intend to target. If this account were a native AAD account to the target tenant, I believe you would not need to specify the tenantId.