Microsoft Secure Score Report via PowerShell

ste 21 Reputation points
2022-08-03T12:49:12.797+00:00

Hi,

I am trying to run Get-AzSecuritySecureScore on my m365 developer account.

I get an error about a missing SubscriptionID which makes sense because i don't have a subscription.

Get-AzSecuritySecureScore : 'this.Client.SubscriptionId' cannot be null.  
At line:1 char:1  
+ Get-AzSecuritySecureScore  
+ ~~~~~~~~~~~~~~~~~~~~~~~~~  
    + CategoryInfo          : CloseError: (:) [Get-AzSecuritySecureScore], ValidationException  
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Security.Cmdlets.Assessments.GetSecureScore  

I am wondering why then, if I go to https://security.microsoft.com/securescore I am able to view the score?

Thank you.

Microsoft Defender for Cloud
Microsoft Defender for Cloud
An Azure service that provides threat protection for workloads running in Azure, on-premises, and in other clouds. Previously known as Azure Security Center and Azure Defender.
1,515 questions
0 comments No comments
{count} votes

Accepted answer
  1. Maxim Sergeev 6,586 Reputation points Microsoft Employee
    2022-08-04T05:54:07.03+00:00

    Hi there, I expect you want to collect Office365 secure scores. In this case it's better to make direct calls to Graph.

    As an example, https://github.com/directorcia/Office365/blob/master/o365-ssdescpt-get.ps1

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Maxim Sergeev 6,586 Reputation points Microsoft Employee
    2022-08-04T06:59:30.447+00:00

    It depends what you want to achieve:)
    Usually, using app registrations is more secure.

    1 person found this answer helpful.
    0 comments No comments

  2. ste 21 Reputation points
    2022-08-04T06:24:19.743+00:00

    Thanks, yes, this is essentially what i want.

    What is the reason/benefit of using an app registration as opposed to a user account?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.