SpanningCloudApps / SB365-Powershell

Spanning Backup for Office 365 REST API PowerShell Module
https://spanning.com
Apache License 2.0
10 stars 5 forks source link

No Data Returned #67

Closed ccsdl closed 1 year ago

ccsdl commented 1 year ago

I was able to import the module, but Get-SpanningTenantInfo throws an error in one of the files and any variation of Get-SpanningUser returns blanks. None of the other commands fail, just returns no data. If I pipe it to a file it gives a greek symbol as the only piece of data.

Anyone else have issues with the authentication and commands being accepted but getting no data?

SPMatthewMcD commented 1 year ago

I just tested it and it's working for me.

Are you certain that you are using the same API key for the admin account that generated it?

ccsdl commented 1 year ago

Yes, it seemed to be pretty bizarre behavior as it doesn't generate any kind of error and seems to return a result of no results. I will be tinkering with it some more tomorrow, hopefully I will have a break through.

IS this intended to be used with MSP deployments where we have multiple organizations and clients or is this intended to be used for a single organizational tenant? Maybe that's where mine is getting a bit goofy.

SPMatthewMcD commented 1 year ago

Devin,

It is not "multi-tenant" in that way. You have to log into each tenant with Microsoft credentials (not K1 credentials) to generate the api key. (So, today, you cannot generate an "MSP Key" that has access to all your tenants. Though we have heard that request.)

Let me know if you get it worked out. If you need to do a quick screen sharing session, I can make some time. Or shoot me the tenant name and API key privately to matt.mcdermott@spanning.com and I can run a quick test.

Don't post the API key here....but you knew that.

SPMatthewMcD commented 1 year ago

@ccsdl Did you get it working?

ccsdl commented 1 year ago

Yes, the issue is that an api key generated under an MSP account simply will not work. I needed to log in to spanning using "Log in with o365" and use each tenant individually to generate an api key with an account that was specific to a client tenant. Then store that API key and iterate through each tenant and api key and export a separate list.

Now that this is done, is there documentation on how to get individual datapoints back from the get-users? If I wanted to just get back the email address and assigned status of true or false in a two column spreadsheet? Sorry if these are simple questions but I am fairly new to using third party api's in powershell.

Devin Lewis

SPMatthewMcD commented 1 year ago

Great!

You can try and adapt this Export sample for your needs: https://github.com/SpanningCloudApps/SB365-Powershell/blob/master/samples.md#license-users-with-an-office-365-license

Like:

Get-SpanningUser -UserType All|`
Select userPrincipalName, assigned | `
Export-Csv -Path .\sample.csv -NoTypeInformation

If you can't figure it out let me know and I can gen something up for you.