soteria-security / 365Inspect

A PowerShell script that automates the security assessment of Microsoft 365 environments.
https://soteria.io/solutions/soteria-inspect/
MIT License
577 stars 109 forks source link

Could not connect to SharePoint Online #50

Closed actionitservices closed 1 year ago

actionitservices commented 1 year ago

Describe the bug The SharePoint Connect command is failing due to error in the URL string. Error: Connect-SPOService : Could not connect to SharePoint Online. Connect-SPOService -Url "https://$org_name-admin.sharepoint

$org_name is also incorrect as it contains .onmicrosoft.com. SharePoint URL should be like: https://contoso-admin.sharepoint.com

My nasty fix using sub string $length = $org_name.length $pos=$length - 16
$org_name_short = $org_name.substring(0, $pos) $spURL = "https://" + $org_name_short + "-admin.sharepoint.com"

Connect-SPOService -Url $spURL

ThoughtContagion commented 1 year ago

Hi there!

Thank you for using 365Inspect!

This appears to be caused by some lack of clarity in our README, which we will update to clarify the language used. We are also exploring the potential for a way to pull this information without the need to require direct user input to make it easier for users and reduce the amount of information needed to begin the assessment.

From our README:

To break down the parameters further:

OrgName is the name of the core organization or "company" of your O365 instance, which will be inspected. If you do not know your organization name, you can navigate to the list of all Exchange domains in O365. The topmost domain should be named domain_name.onmicrosoft.com. In that example, domain_name is your organization name and should be used when executing 365Inspect.

For example, if your domain listed is mycompany.onmicrosoft.com, then your $org_name variable would be mycompany.

actionitservices commented 1 year ago

ah true, my bad. Thanks @ThoughtContagion. Handy script! I can see those changes in the latest commit, thanks!