EvotecIT / O365Essentials

A module that helps to manage some tasks on Office 365/Azure via undocumented API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get-O365Domain 401 (Unauthorized)

krzydoug opened this issue · comments

Both attempts result in the same error of

WARNING: Invoke-O365Admin - Error: Response status code does not indicate success: 401 (Unauthorized).

Attempt 1
Connect-O365Admin Get-O365Domain

Attempt2
Get-O365Domain # browser window opens and authentication complete

There are several commands that either give 401 or 403. I did not see any required setting changes in the documentation. The first example is connect and then Get-O365Domain.

Well, I was testing this with the Global Admin account. I would expect Global Reader would work.

What are you using to access that data?

I am using a Global Admin account. I also had to uninstall old versions of AZ module before I could import O365Essentials.

Is it working now or still an issue?

$Headers = Connect-O365Admin
ConvertFrom-JsonWebToken -Token $Headers.AccessTokenO365

Does that show you proper token information?

Get-Module -listavailable az.accounts

Also, can you try on some clean machine? Maybe something gets cached locally and is getting used somehow?

can you leave only 2.5.3 ? The rest seems ok. The only thing that differs for me is region scope (EU for me)

You got any other tenants to check?

Brand new windows 10 pc, fresh install of pwsh
image

I do have other tenants, and I just tested one and it worked. So it's something about this tenant or this admin account. I'll test with another account and let you know. Appreciate all the work you put in and share with us.