Giter Site home page Giter Site logo

azureadassessment's Introduction

Microsoft Azure AD Assessment

PSGallery Version PSGallery Downloads PSGallery Platform

Assessor Guide

If you are a Microsoft employee or partner performing the assessment for a customer please see the Wiki for the Assessment Guide.

Install from the PowerShell Gallery

If you run into any errors please see the FAQ section at the end of this document.

Install-Module AzureADAssessment -Force -Scope CurrentUser

## If you have already installed the module, run the following instead to ensure you have the latest version.
Update-Module AzureADAssessment -Force -Scope CurrentUser

Create an app in Entra ID

The assessment requires a custom app to be created in your tenant.

  • Open Entra admin center > Identity > Applications > App registrations
  • Select New registration
    • Name: Enter a name for the application (e.g. Entra Assessment Account)
    • Redirect URI:
      • Select Mobile and desktop applications from the drop down
      • Set the uri as https://login.microsoftonline.com/common/oauth2/nativeclient
    • Select Register to create the app
  • Select the Authentication blade of the app you just created from the left navigation
  • Set Allow public client flows to Yes
  • Click Save

Run the Data Collection

Data collection from Azure AD can be run from any client with access to Azure AD. However, data collection from hybrid components such as AD FS, AAD Connect, etc. are best run locally on those servers. The AAD Connect data collection needs to be run on both Primary and Staging servers.

Verify that you have authorized credentials to access these workloads:

  • Azure Active Directory as Global Administrator or Global Reader
  • Domain or local administrator access to ADFS Servers
  • Domain or local administrator access to Azure AD Proxy Connector Servers
  • Domain or local administrator access to Azure AD Connect Server (Primary)
  • Domain or local administrator access to Azure AD Connect Server (Staging Server)

When Connecting for the first time you will be asked to consent to the permissions needed by the assessment. An admin will be needed to provide consent.

Run following commands to produce a package of all the Azure AD data necessary to complete the assessment.

## Authenticate using a Global Admin or Global Reader account.
Connect-AADAssessment -ClientId "AppId of app created in the previous step"

## Export data to "C:\AzureADAssessment" into a single output package.
Invoke-AADAssessmentDataCollection

The output package will be named according to the following pattern: AzureADAssessmentData-<TenantDomain>.aad

If Data Collection command fails before completing, try running it again with the SkipReportOutput parameter.

Invoke-AADAssessmentDataCollection -SkipReportOutput

On each server running hybrid components, install the same module and run the Invoke-AADAssessmentHybridDataCollection command.

## Export Data to "C:\AzureADAssessment" into a single output package.
Invoke-AADAssessmentHybridDataCollection

The output package will be named according to the following pattern: AzureADAssessmentData-<Svc>-<ServerName>.zip

Once data collection is complete, provide the output packages to whoever is completing the assessment. Please avoid making any changes to the generated files including the name of the file.

Complete Assessment Reports

If you are generating and reviewing the output yourself, please see the Wiki for the Assessment Guide.

Frequently Asked Questions

I don't have internet access to install the module on AAD Connect, ADFS, App Proxy servers

To collect data from hybrid components (such as AAD Connect, AD FS, AAD App Proxy), you can export a portable version of this module that can be easily copied to servers with no internet connectivity.

## Export Portable Module to "C:\AzureADAssessment".
Export-AADAssessmentPortableModule "C:\AzureADAssessment"

On each server running hybrid components, copy the module file "AzureADAssessmentPortable.psm1" and import it there.

## Import the module on each server running hybrid components.
Import-Module "C:\AzureADAssessment\AzureADAssessmentPortable.psm1"

## Export Data to "C:\AzureADAssessment" into a single output package.
Invoke-AADAssessmentHybridDataCollection

I want to output the assessment files to a different directory

## If you would like to specify a different directory, use the OutputDirectory parameter.
Invoke-AADAssessmentDataCollection "C:\Temp"
Invoke-AADAssessmentHybridDataCollection "C:\Temp"

I want to use a service principal identity to run the assessment instead of a user identity

If you prefer to use your own app registration (service principal) for automation purposes, you may connect using your own ClientId and Certificate like the example below. Your app registration should include Directory.Read.All, Policy.Read.All, and AuditLog.Read.All application permissions to MS Graph for a complete assessment. Once added, ensure you have completed admin consent on the service principal for those permissions.

## Connect using Service Principal identity with app permissions.
Connect-AADAssessment -ClientId <ClientId> -ClientCertificate (Get-Item 'Cert:\CurrentUser\My\<Thumbprint>') -TenantId <TenantId>

I have a tenant in sovereign cloud, how do I run this assessment?

You must create an application registration in your tenant and provide the ClientId when running Connect-AADAssessment. The default application configuration should work as long as you define the correct redirect URI for your cloud environment. For example, a "Mobile and desktop application" Redirect URI of https://login.microsoftonline.us/common/oauth2/nativeclient.

## Example connecting to USGov cloud environment using user delegated permissions.
Connect-AADAssessment -ClientId <ClientId> -CloudEnvironment USGov -TenantId <TenantId>

## Example connecting to USGov cloud environment using app permissions.
Connect-AADAssessment -ClientId <ClientId> -ClientCertificate (Get-Item 'Cert:\CurrentUser\My\<Thumbprint>') -CloudEnvironment USGov -TenantId <TenantId>

When trying to install the module I'm receiving the error 'A parameter cannot be found that matches parameter name 'AcceptLicense'

Run the following command to update PowerShellGet to the latest version before attempting to install the AzureADAssessment module again. Option 1 is a single command executing a script (https://aka.ms/Update-PowerShellGet), while option 2 requires multiple commands and some possible troubleshooting.

### Option 1: Run the following command to download and execute a script to update PowerShellGet. Note: Navigate to this URL in a web browser to see the contents of the script in GitHub.
iex $(irm 'https://aka.ms/Update-PowerShellGet')

### Option 2: Run the following commands individually.
## Update Nuget Package and PowerShellGet Module
Install-PackageProvider NuGet -Scope CurrentUser -Force
Install-Module PowerShellGet -Scope CurrentUser -Force -AllowClobber
## Remove old modules from existing session
Remove-Module PowerShellGet,PackageManagement -Force -ErrorAction Ignore
## Import updated module
Import-Module PowerShellGet -MinimumVersion 2.0 -Force
Import-PackageProvider PowerShellGet -MinimumVersion 2.0 -Force

If at any point you see the error, <Path> cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170., you must enable local scripts to be run.

## Set globally on device
Set-ExecutionPolicy RemoteSigned
## Or set for just for current PowerShell session.
Set-ExecutionPolicy RemoteSigned -Scope Process

MSAL.PS Certificate Error (Authenticode issuer)

The signing certificate for MSAL.PS is changing to use Microsoft's code signing process. If you see the following error, PackageManagement\Install-Package : Authenticode issuer 'CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' of the new module 'MSAL.PS' with version 'x.x.x.x' from root certificate authority 'CN=Microsoft Root Certificate Authority 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' is not matching with the authenticode issuer 'CN=Jason Thompson, O=Jason Thompson, L=Cincinnati, S=Ohio, C=US' of the previously-installed module 'MSAL.PS' with version 'x.x.x.x' from root certificate authority 'CN=DigiCert Assured ID Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US'. If you still want to install or update, use -SkipPublisherCheck parameter., you can resolve it using the following command.

Install-Module MSAL.PS -SkipPublisherCheck -Force

Unable to sign in with device code flow

If you are using PowerShell Core (ie PowerShell 6 or 7) and your tenant has a conditional access policy that requires a Compliant or Hybrid Azure AD Joined device, you may not be able to sign in.

To work around this issue use Windows PowerShell (instead of PowerShell 6 or 7). To launch Windows PowerShell go to Start > Windows PowerShell

Unable to load data in PowerBI templates

When you open the powerbi templates, you will be asked to reference the folder where the extracted data resides (csv and json). Once selected PowerBI will load the data. While doing so PowerBI might complain with errors crossreferncing data sources:

Query '*' (step '*') references other queries or steps, so it may not directly access a datasource. Please rebuild this data combination.  

To workarround this, configure PowerBI file settings to ignore privacy settings:

  • File > Options and settings > Options
  • In Options under CURRENT FILE find the Privacy
  • In Privacy Levels select Ignore the Privacy Levels and potentially improve performance

Contents

File/folder Description
build Scripts to package, test, sign, and publish the module.
src Module source code.
tests Test scripts for module.
.gitignore Define what to ignore at commit time.
README.md This README file.
LICENSE The license for the module.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

For more detailed guidance and recommendations for contributing, see the page for contributing.

azureadassessment's People

Contributors

alexcesarini avatar cblomart avatar jazuntee avatar merill avatar metabpa avatar microsoftopensource avatar msftgits avatar poshchap avatar ramical avatar slbishop avatar tylchan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azureadassessment's Issues

PowerBI information tabs missing

I ran the Invoke-AADAssessmentDataCollection PowerShell scripts to acquire the Azure AD information. Without any error message this process succeeds. Also the report generation Complete-AADAssessmentReports runs succesfully.
In the AzureADAssessment PowerBI overview I have the following 4 tabs: Roles & Notification - App Assignments - App keys - Consent Grant.

However when I go through the Assessment guide it references to the following tabs in PowerBI which I seem to be missing.
Power BI: Tab "AADCH – Alerts", "Sync Performance", and "Sync – Object Count"

Am I missing something, need to run another script/parameter to get the AAD Connect Health information? My account has Global Reader access to the tenant. Thanks.

The property 'StatusDescription' cannot be found on this object. error in AzureADAssessment\2.2.2\internal\Get-MsGraphResults.ps1:308

Whenever I run Invoke-AADAssessmentDataCollection I get the following error:

Catch-MsGraphError: C:\Users\USER\Documents\PowerShell\Modules\AzureADAssessment\2.2.2\internal\Get-MsGraphResults.ps1:308
Line |
308 | catch { Catch-MsGraphError $_ }
| ~~~~~~~~~~~~~~~~~~~~~
| The property 'StatusDescription' cannot be found on this object. Verify that the property exists.

What is GTP

The slide deck contains a phrase "follow up with GTP PM" what does GTP mean?

PowerBI files

why are there 2 separate PowerBI files? how are they intended to be used? What are the instructions for logging in with them?

Error: The "guid" property was not found for this object. Make sure that the property is present.

When running Invoke-AADAssessmentDataCollection -OutputDirectory 'C:\Temp\azureadassessment' I get an error.

Sorry for German. Don't know how to switch Powershell to English output. Deepl translation of this error: "The "guid" property was not found for this object. Make sure that the property is present."

Die Eigenschaft "guid" wurde für dieses Objekt nicht gefunden. Vergewissern Sie sich, dass die Eigenschaft
vorhanden ist.
In C:\Program
Files\WindowsPowerShell\Modules\AzureADAssessment\2.2.36\Invoke-AADAssessmentDataCollection.ps1:228
Zeichen:9

  •     $ReferencedIdCache.roleGroup.guid | Get-MsGraphResults 'group ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : PropertyNotFoundStrict

Not collecting the correct amount of users

Running this for a client and it is only reporting approximately 1000 of 8000 users. We have run multiple times, multiple source user accounts, same issue. We have uninstalled, reinstalled, and force updated the module over a period of several weeks with no improvement.

ForEach-Object: Cannot convert argument "item", with value: "MicrosoftAdminPortals"

Hi everyone,

I have an environment where the report creation fails with following error:

ForEach-Object: Cannot convert argument "item", with value: "MicrosoftAdminPortals", for "Add" to type "System.Guid": "Cannot convert value "MicrosoftAdminPortals" to type "System.Guid". Error: "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).""

How can I solve this please, any idea is welcome.

cheers

Loading blocked by failures with other queries

When I open the AzureADAssessment-ConditionalAccess powerbi file, I get many errors like " conditionalAccessPolicy
Loading blocked by failures with other queries." Is this expected behavior if there are not any CA policies in the tenant? I am in a tenant that has the Security Defaults enabled. Would this be causing this type of error?

Unable to run report due to Microsoft Admin Portals Application

After configuring the Application Registration and connection the next step is unable to complete in an environment that utilises Microsoft Admin Portals as there isn't a ClientID that the command can interpret to a GUID.

ForEach-Object : Cannot convert argument "item", with value:
"MicrosoftAdminPortals", for "Add" to type "System.Guid": "Cannot convert
value "MicrosoftAdminPortals" to type "System.Guid". Error: "Guid should
contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).""
At E:\Documents\WindowsPowerShell\Modules\AzureADAssessment\2.4.0\AzureADAssess
ment.psm1:143 char:132

  • ... ice365' } | ForEach-Object { [void]$ReferencedIdCache.appId.Add($_) } ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     
    
    • CategoryInfo : NotSpecified: (:) [ForEach-Object], MethodExcept
      ion
    • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument,Micr
      osoft.PowerShell.Commands.ForEachObjectCommand

Disconnecting

I don't see a disconnect-azureAdAssessment cmdlet. What is the recommended method for running this against multiple tenants?

Connection Error, The property 'TokenType' cannot be found

Cmdlet Connect-AADAssessment fails during connection after typing in the credentials and confirming the permission:

Confirm-ModuleAuthentication : The property 'TokenType' cannot be found on this object. Verify that the property exists.
At C:\Program Files\WindowsPowerShell\Modules\AzureADAssessment\2.4.0\AzureADAssessment.psm1:3897 char:9
+         Confirm-ModuleAuthentication $script:ConnectState.ClientAppli ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Confirm-ModuleAuthentication], PropertyNotFoundException
    + FullyQualifiedErrorId : PropertyNotFoundStrict,Confirm-ModuleAuthentication
Get-Module AzureADAssessment -ListAvailable
# Script     2.4.0      AzureADAssessment

Get-Module MSAL.PS -ListAvailable
# Script     4.37.0.0   MSAL.PS

Using the Cmdlet with an App Registration Connect-AADAssessment -ClientId does also not work.

Solution (FAQ): Restart Windows PowerShell ISE

Error on AADPremium Identifiers

Hello,

There are an error in the AAD Premium identifiers:

File Get-AADAssessUserReport.ps1, the fix is:

$aadp1plan = "41781fb2-bc02-4b7c-bd55-b576c07bb09d"
$aadp2plan = "eec0eb4f-6444-4f95-aba0-50c24d67f998"

File Invoke-AADAssessmentDataCollection.ps1 , the fix is:

if ($skus | Where-Object { $_.prepaidUnits.enabled -gt 0 -and ($_.servicePlans | Where-Object { $_.servicePlanId -eq "41781fb2-bc02-4b7c-bd55-b576c07bb09d" })}) {
            $licenseType = "P1"
        } elseif ($skus | Where-Object { $_.prepaidUnits.enabled -gt 0 -and ($_.servicePlans | Where-Object { $_.servicePlanId -eq "eec0eb4f-6444-4f95-aba0-50c24d67f998" })}) {
            $licenseType = "P2"
        }

Cannot convert argument "item", with value: "Office365", for "Add" to type "System.Guid"

Hello all together,

I try out this module in my test environment and in a second tenant and I get this error.

`ForEach-Object : Cannot convert argument "item", with value: "Office365", for "Add" to type "System.Guid": "Cannot convert value "Office365" to type "System.Guid". Error: "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).""
At C:\Program Files\WindowsPowerShell\Modules\AzureADAssessment\2.0.776660\internal\Add-AadReferencesToCache.ps1:50 char:76

  • ... lications | ForEach-Object { [void]$ReferencedIdCache.appId.Add($_) } ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [ForEach-Object], MethodException
    • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument,Microsoft.PowerShell.Commands.ForEachObjectCommand`

after this error, the Cmdlet stops.

The line where the error occurs, has this content:
Line:50 $InputObject.conditions.applications.excludeApplications | ForEach-Object { [void]$ReferencedIdCache.appId.Add($_) }

Does someone know the error?

Thanks
Arne

CA recommendation Office 365 Coverage check

Hello Guys,
I have been running a few assessment as of late and have run in to a bug that keeps coming back. For multiple tenants, in the Conditional Access assessment report (powerbi) i get the following recommendation:
image
However, the CA in question always has this:
image
image

I think this might be a bug, or am i missing something?

Greatly appreciated. keep up the good work!

Unable to open the Power BI 'AzureADAssessment.pbit'

Hello,
Im supernew to this tool and was testing it out.
I was able to follow the wiki just fine (superb one btw!), i came all the way down to opening the two Power Bi reports:
AzureADAssessment.pbit
AzureADAssessment - ConditionalAccess.pbit
The ConditionalAccess one works just fine, but the AzureAdAssessment does not.

It has successfully created cvs and json files with content (if i open them they look correctly formated to!):
image
(Note that i do not use any AD sync or connectors, so i skipped that step in the pre-req)

When i run the AzureADAssessment.pbit i get the following error:
image
Those seems to be these:
image
image

Any help or suggestion greatly appreciated!

Generate Azure AD Config Documenter Report breaks

Trying to generate the assessment report as shown in the example

Expand-AADAssessAADConnectConfig -CustomerName 'Bananas' `
  -AADConnectProdConfigZipFilePath C:\AzureADAssessment\Bananas\AzureADAssessmentData-bananas.onmicrosoft.com.zip `
    -OutputRootPath C:\AzureADAssessment\Bananas\Report\AADC 

When I run the command, it breaks with the following error message. Hope you can fix this.

AADConnectSyncDocumenterConsole Error: 40000 : AADConnectSyncDocumenter (1.19.0130.0): 08/06/2021 13:58:45.0600:
Exception in 'AzureADConnectSyncDocumenter : ValidateInput'. Details: System.IO.FileNotFoundException: The pilot / target
configuration directory 'C:\AzureADAssessment\Report\AADC\Bananas\Data\Bananas\Production' does not exist..

Does not contain 'Op_Addition' -

AzureADAssessment works fine on my Live Tenant however fails on my Developer Environment.

Not sure what it's asking for?

"
Test-MsGraphBatchError : Value cannot be null.
Parameter name: source
At C:\Program Files\WindowsPowerShell\Modules\AzureADAssessment\2.2.54\internal\Get-MsGraphResults.ps1:309 char:31

  • ... if (!(Test-MsGraphBatchError $results $currentRequest)) {
  •                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : ArgumentNullException,Test-MsGraphBatchError

WARNING: The export package has not been generated
WARNING: If you are working with microsoft or a provider on the assessment please warn them
WARNING: Please check GitHub issues and fill a new one or reply on existing ones mentionning the errors seen
WARNING: https://github.com/AzureAD/AzureADAssessment/issues
Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
At C:\Program Files\WindowsPowerShell\Modules\AzureADAssessment\2.2.54\Invoke-AADAssessmentDataCollection.ps1:149
char:13

  •         $roleAssignmentSchedules + $roleAssignmentSchedulesAdditi ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (op_Addition:String) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : MethodNotFound "

Catch-MsGraphError : Request Authorization failed

I start the assessment with an non privileged user. I have Global Reader and Security Reader role assignments and you wrote, that for that we need the following rights.

Azure Active Directory as Global Administrator or Global Reader

When I start the assessment with the roles described above I get this error.
`
Catch-MsGraphError : Request Authorization failed
At C:\Program Files\WindowsPowerShell\Modules\AzureADAssessment\2.0.779889\internal\Get-MsGraphResults.ps1:247 char:25

  •             catch { Catch-MsGraphError $_ }
    
  •                     ~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Write-Error], WebException
    • FullyQualifiedErrorId : accessDenied,Catch-MsGraphError
      `

And when I check the outputs, the following file is missing:

  • emailOTPMethodPolicy.json

When I start the assessment with Global administrative rigths no error occurs and the missing file is created.

Have a nice day
Arne

AzureAD Assessment not able to pull all the data from Entra ID

I have been trying to use the AAD-Assessment tool to run the assessment for Entra ID. But it seems that the tool does not pull all the data and in fact misses few data example there were 100 CA Policies in the environment, but the report was missing almost 40CA policies also it does miss to pull all the Users these are few of them.

How can we get the full assessment done correctly if we are not able to pull all the data from AzureAD ?
Please do let us know if there is a way so that we do not miss on any data while utilizing this tool.

403 response in a few of the API Calls

Hello,

I'm trying to test the assessment in a test Tenant and I meet the requirements, having the Global Admin role, but i'm getting a few errors on the API calls, for example:

WARNING: GET https://graph.microsoft.com/beta/roleManagement/directory/roleAssignmentSchedules?$expand=principal(%24select%3Did)%2CroleDefinition(%24select%3Did%2CtemplateId%2CdisplayName)&$filter=status+eq+%27Provisioned%27+and+assignmentType+eq+%27Assigned%27+and+directoryScopeId+eq+%27%2F%27&$select=id%2CdirectoryScopeId%2CmemberType%2CscheduleInfo%2Cstatus%2CassignmentType; error Response status code does not indicate success: 403 (Forbidden).; attempt 5 out of 5. Retrying after 16s

Here's the debug output:

DEBUG: {
"name": "AppExceptions",
"time": "2022-06-10T21:15:29.8607225Z",
"iKey": "9ef9a343-9c69-4468-a1a0-e1786a6d9f89",
"tags": {
"ai.application.ver": "2.2.36",
"ai.operation.id": "ecd8a0e3-b896-4e56-92a4-9894c33227c7",
"ai.operation.name": "Invoke-AADAssessmentDataCollection",
"ai.operation.parentId": "",
"ai.session.id": "236b794b-0bbd-4494-935f-9c6aad7510ff",
"ai.user.id": "@{",
"ai.device.osVersion": "Microsoft Windows 10.0.22000"
},
"data": {
"baseType": "ExceptionData",
"baseData": {
"ver": 2,
"properties": {
"Culture": "en-US",
"PsEdition": "Core",
"PsVersion": "7.2.4",
"DebugPreference": 2,
"TenantId": "",
"CloudEnvironment": "Global"
},
"exceptions": [
{
"hasFullStack": true,
"parsedStack": [],
"typeName": "Microsoft.PowerShell.Commands.WriteErrorException",
"message": "Attempted to perform an unauthorized operation.",
"id": 3556833
}
]
}
}
}
DEBUG: {
"id": "11",
"status": 403,
"headers": {
"Content-Type": "application/json"
},
"body": {
"error": {
"code": "UnauthorizedAccessException",
"message": "Attempted to perform an unauthorized operation.",
"innerError": {
"date": "2022-06-10T21:15:27",
"request-id": "49bd963e-f3ea-40c2-ad4e-5185d410b1ef",
"client-request-id": "49bd963e-f3ea-40c2-ad4e-5185d410b1ef"
}
}
}
}
image

Error when accessing Conditional Access Policies

WARNING: The export package has not been generated
WARNING: If you are working with microsoft or a provider on the assessment please warn them
WARNING: Please check GitHub issues and fill a new one or reply on existing ones mentionning the errors seen
WARNING: https://github.com/AzureAD/AzureADAssessment/issues
ForEach-Object: Cannot convert argument "item", with value: "MicrosoftAdminPortals", for "Add" to type "System.Guid": "Cannot convert
value "MicrosoftAdminPortals" to type "System.Guid". Error: "Guid should contain 32 digits with 4 dashes
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).""

The property 'Count' cannot be found on this object. Verify that the property exists.

I get this error when it tries to process Service Principles. I am running it on Windows 11.

PS C:\Users\jserban\OneDrive - Microsoft\Documents\GitHub\AzureADAssessment> Invoke-AADAssessmentDataCollection
Exporting applications: Completed 2 in 00:00:00
Exporting appRoleAssignments: Completed 32 in 00:00:00
Exporting oauth2PermissionGrants: Completed 12 in 00:00:00
Exporting servicePrincipals (JSON): Completed 15 in 00:00:00
Exporting servicePrincipals (CSV): Completed 15 in 00:00:00
Exporting groups: Completed 7 in 00:00:00
Loading users in lookup cache
Loading users registration details in lookup cache
Exporting UserReport: Completed 11 in 00:00:00
Loading groups in lookup cache
Exporting NotificationsEmailsReport: Completed 9 in 00:00:00
Loading administrative units in lookup cache
Loading applications in lookup cache
Loading service principals in lookup cache
WARNING: The export package has not been generated
WARNING: If you are working with microsoft or a provider on the assessment please warn them
WARNING: Please check GitHub issues and fill a new one or reply on existing ones mentionning the errors seen
WARNING: https://github.com/AzureAD/AzureADAssessment/issues
Format-Csv: C:\Program Files\WindowsPowerShell\Modules\AzureADAssessment\2.2.64\Export-AADAssessmentReportData.ps1:226:11
Line |
226 | | Format-Csv `
| ~~~~~~~~~~
| The property 'Count' cannot be found on this object. Verify that the property exists.

Install-Module -AcceptLicense not supportedi in WPS 5.1

When following the guide, if you are using Windows PowerShell 5.1, the install-module does not support -acceptlicense parameter and will throw an error.

Consider updating docs to recommend using latest PS 7.x, or provide examples of command when running on WPS 5.1 without the switch to avoid errors those not as familiar with PowerShell

Index was outside the bounds of the array when calling Invoke-AADAssessmentDataCollection

Error bellow when calling Invoke-AADAssessmentDataCollection

image

When I debug 2.2.2\internal\Expand-MsGraphRelationship.ps1 it turns out that:

  • $inputObject contained one item
    image when final block started. But $results variable was empty, because there was no user in "Exchange administrator" role! Therefore error on line [array] $refValues = $Results[$i]
  • btw $uri contained directoryRoles/{0}/members/$ref

SOLUTION?
In 2.2.2\internal\Expand-MsGraphRelationship.ps1 modify both foreach
from:
for ($i = 0; $i -lt $InputObjects.Count; $i++) {
to:
for ($i = 0; $i -lt $Results.Count; $i++) {

Request was throttled - Failing

Hello AzureADAssessment-Team,

since the last versions I'm running in a issue in our production environment.
After a long runtime of 1h 50m there is multiple throttlling occuring:

WARNING: Using a confidential client is non-interactive and requires that the necessary scopes/permissions be added to the application or have permissions on-behalf-of a user.
WARNING: Using a confidential client is non-interactive and requires that the necessary scopes/permissions be added to the application or have permissions on-behalf-of a user.
WARNING: Using a confidential client is non-interactive and requires that the necessary scopes/permissions be added to the application or have permissions on-behalf-of a user.
WARNING: Request returned error and will attempt retry 1 of 5 after 30s.
WARNING: Request returned error and will attempt retry 2 of 5 after 60s.
WARNING: Request returned error and will attempt retry 3 of 5 after 120s.
WARNING: Request returned error and will attempt retry 4 of 5 after 240s.
WARNING: Request was throttled and will attempt retry 5 of 5 after 30s

And then comes the fail:

Catch-MsGraphError : This request is throttled. Please try again after the value (in seconds) specified in the Retry-After header. CorrelationId: 638b720b-aa65-4df0-852e-5bfd4d0dd708
At C:\Users\VssAdministrator\Documents\PowerShell\Modules\AzureADAssessment\2.3.11\internal\Get-MsGraphResults.ps1:484 char:49
+                                                 Catch-MsGraphError $_
+                                                 ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Method: GET, Reques…ssessment/2.3.11
}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException
+ FullyQualifiedErrorId : UnknownError,Catch-MsGraphError
##[error]PowerShell exited with code '1'

In smaller Environments (e.q. our test environment) I do not run into a issue.
I noticed that on older versions not so much throtteling was happening.

Maybe there is error in the retry logic.

Looking forward to an answer.

The export package has not been generated

Hi Team,

We are getting below an error while running invoke-AADAssessmentdatacollection cmdlet.

WARNING: The export package has not been generated
WARNING: If you are working with microsoft or a provider on the assessment please warn them
WARNING: Please check GitHub issues and fill a new one or reply on existing ones mentionning the errors seen
WARNING: https://github.com/AzureAD/AzureADAssessment/issues
ForEach-Object : Cannot convert argument "item", with value: "MicrosoftAdminPortals", for "Add" to type "System.Guid": "Cannot convert value "MicrosoftAdminPortals" to type
"System.Guid". Error: "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).""
At C:\Users\SadishKk\Documents\WindowsPowerShell\Modules\AzureADAssessment\2.5.0\AzureADAssessment.psm1:143 char:132

  • ... ice365' } | ForEach-Object { [void]$ReferencedIdCache.appId.Add($_) } ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [ForEach-Object], MethodException
    • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument,Microsoft.PowerShell.Commands.ForEachObjectCommand

Query 'StaleUsersExcluded' (step 'Added staleUserExcluded') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.

After applying some of the conditional access recommendations, I wanted to run another assessment against our tenant to see what the recommendations look like after the changes.

Upon rerunning it, and opening AzureADAssessment-ConditionalAccess.pbit I get the following error:
Query 'StaleUsersExcluded' (step 'Added staleUserExcluded') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.

I tried running the assessment with our breakglass account which is excluded from every CA policy, so I don't think the changes I made have broken the report

Thoughts?

image

Add-AzureAssessmentTask doesn't support MFA parameter

Hello,
maybe this isn't the right place however I discovered the Add-AzureAssessmentTask doesn't support the -MFA parameter (despite I can read it referenced in documentation).

Get-Command Add-AzureAssessmentTask

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Add-AzureAssessmentTask                            8.0.1.1086 Microsoft.PowerShell.Oms.Assessments

I have installed the latest version of Microsoft Monitoring Agent (MMA) v10.20.18067.0 available in Log Analytics workspaces.

This is my fault or it doesn't support the -MFA parameter anymore ?

issue when collecting data

PS /home/s.gioria/github.com/AzureAD/AzureADAssessment> Invoke-AADAssessmentDataCollection -OutputDirectory /home/s.gioria/github.com/AzureAD/AzureADAssessment/reports 
                                                                                                                        
    Directory: /home/s.gioria/github.com/AzureAD/AzureADAssessment/reports/AzureADAssessmentData                        
                                                                                                                        
UnixMode   User             Group                 LastWriteTime           Size Name                                     
--------   ----             -----                 -------------           ---- ----                                     
drwxrwxr-x s.gioria         s.gioria           05/24/2023 11:23           4096 AAD-XXXXXXX.onmicrosoft.com             
Exporting applications: Completed 209 in 00:00:00                                                                       
Exporting appRoleAssignments: Completed 1,675 in 00:00:00                                                               
Exporting oauth2PermissionGrants: Completed 3,718 in 00:00:00                                                           
Exporting servicePrincipals (JSON): Completed 621 in 00:00:00                                                           
Exporting servicePrincipals (CSV): Completed 621 in 00:00:00                                                            
Exporting groups: Completed 18 in 00:00:00                                                                              
Loading users in lookup cache                                                                                           
Loading users registration details in lookup cache                                                                      
Exporting UserReport: Completed 1,547 in 00:00:01                                                                       
Loading groups in lookup cache                                                                                          
Loading administrative units in lookup cache                                                                            
Loading applications in lookup cache                                                                                    
Loading service principals in lookup cache                                                                              
Exporting RoleAssignmentReport: Completed 323 in 00:00:00                                                               
WARNING: Required entry 'AAD-*/AppCredentialsReport.csv' not found or empty                                             
WARNING: Required entry 'AAD-*/applications.json' not found or empty                                                    
WARNING: Required entry 'AAD-*/appRoleAssignments.csv' not found or empty                                               
WARNING: Required entry 'AAD-*/ConsentGrantReport.csv' not found or empty                                               
WARNING: Required entry 'AAD-*/groups.csv' not found or empty                                                           
WARNING: Required entry 'AAD-*/oauth2PermissionGrants.csv' not found or empty                                           
WARNING: Required entry 'AAD-*/RoleAssignmentReport.csv' not found or empty                                             
WARNING: Required entry 'AAD-*/servicePrincipals.csv' not found or empty                                                
WARNING: Required entry 'AAD-*/servicePrincipals.json' not found or empty                                               
WARNING: Required entry 'AAD-*/users.csv' not found or empty                                                            
WARNING: The generated package is missing some data                                                                     
WARNING: If you are working with microsoft or a provider on the assessment please warn them                             
WARNING: Please check GitHub issues and fill a new one or reply on existing ones mentionning the errors seen            
WARNING: https://github.com/AzureAD/AzureADAssessment/issues                                                           
Process-AppCredentials: Cannot get property value because "KeySize" is a write-only property.                   ```

Explanation of a tab in the PowerBi report

Hi guys

Can you please describe the App Keys tab in AzureADAssessment PowerBi document?

Me and my team could not find a description regarding this. To me more precisely, its the 'Key Name' when the key type is password.

If we got data in this column, does it show the username, password or what does it provide us of information? Because we got different kind of data in this column sometimes that confuse us.

Thanks in advice

BR

Authentication method registration not found for & Unable to find

Last successfull step: Loading users registration details in lookup cache
Then I see a lot(I mean a lot) of the following warnings: WARNING: authentication method registration not found for

Common for all of the users are that they are disabled/blocked sign-in.

The following occurs from the job:

Exporting UserReport: Completed 30 261 in 00:01:50
Loading groups in lookup cache
Exporting NotificationsEmailsReport: Completed 80 in 00:00:00
Loading administrative units in lookup cache
Loading applications in lookup cache
Loading service principals in lookup cache
Exporting RoleAssignmentReport: Completed 621 in 00:00:00
Exporting AppCredentialsReport: Completed 204 in 00:00:00
Exporting ConsentGrantReport: Completed 22 106 in 00:00:56
WARNING: The export package has not been generated
WARNING: If you are working with microsoft or a provider on the assessment please warn them
WARNING: Please check GitHub issues and fill a new one or reply on existing ones mentionning the errors seen
WARNING: https://github.com/AzureAD/AzureADAssessment/issues
Unable to find type [System.IO.Compression.ZipFile].
At C:\Users<myusername>\Onedrive - mycompany\Documents\WindowsPowerShell\Modules\AzureADAssessment\2.2.54\Invo
ke-AADAssessmentDataCollection.ps1:345 char:13

  •         [System.IO.Compression.ZipFile]::CreateFromDirectory($Out ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.IO.Compression.ZipFile:TypeName) [], ParentContainsErrorRecord
      Exception
    • FullyQualifiedErrorId : TypeNotFound

Property Guid not found in Object - $ReferenceIdCache.group.guid

When running the script I am getting the following error.

InvalidOperation: C:\Users\fakename\Documents\PowerShell\Modules\AzureADAssessment\2.1.52\Invoke-AADAssessmentDataCollection.ps1:250
Line |
250 | $ReferencedIdCache.group.guid | Get-MsGraphResults 'groups/{0 …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The property 'guid' cannot be found on this object. Verify that the property exists.

The line in question is 250

Add nested groups

    $ReferencedIdCache.group.guid | Get-MsGraphResults 'groups/{0}/transitiveMembers/microsoft.graph.group?$count=true&$select=id' -Top 999 -TotalRequests $ReferencedIdCache.group.Count -DisableUniqueIdDeduplication `
    | ForEach-Object { [void]$ReferencedIdCache.group.Add($_.id) }

The final output of the script is not in a zip format as stated in the Readme either nor does it contain the right data for the PowerBI dashboards to work properly. I am unsure what is causing this error. Thanks!

if (!(Test-MsGraphBatchError $results)) {Value cannot be null. Parameter name: source

Have been doing some testing and trying to run through the process against my demo CDX environment and there seems to be a few issues.

  1. if (!(Test-MsGraphBatchError $results)) {Value cannot be null. Parameter name: source
    I got the script to complete as there was a few null values which the script didn't expect by using try and removing remarking the following out:

$ReferencedIdCache.roleGroup.guid | Get-MsGraphResults 'groups/{0}/transitiveMembers/microsoft.graph.group?$count=true&$select=id' -Top 999 -TotalRequests $ReferencedIdCache.roleGroup.Count -DisableUniqueIdDeduplication `
#| ForEach-Object { [void]$ReferencedIdCache.group.Add($_.id) }

  1. It gave the following error but was able to generate the zip file Get-AADAssessRoleAssignmentReport -Offline -RoleAssignmentSch …| Use of the offline parameter requires that all data be provided using the data parameters.
  2. Opening PowerBI I've got data issues as some files are empty as i guess is related to the export not working as expected.

I can provide access to my demo tenant for testing to confirm it's not environmental but my collogue also tried against his own CDX environment and also gave errors. When I executed against an production tenant it failed.

I've added rough quick debugging results that might help
AADAssessmentDebug31-05-2022.docx
.

Connect-AADAssessment does not work on cloudshell

PS /home/ga> Connect-AADAssessment
Connect-AADAssessment: The 'Connect-AADAssessment' command was found in the module 'AzureADAssessment', but the module could not be loaded. For more information, run 'Import-Module AzureADAssessment'.

Using service pricipal not working

Hello together,
I try to run the assessment with an service principal and setup delegated graph permission for Directory.Read.All and Policy.Read.All but I get the errors below.

I think we mss some permissions in ms graph.

Catch-MsGraphError : Applications without a signed-in user are not allowed access to this report or data.
At C:\Program Files\WindowsPowerShell\Modules\AzureADAssessment\2.3.7\internal\Get-MsGraphResults.ps1:372 char:33
+                                 Catch-MsGraphError $_
+                                 ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Write-Error], WebException
    + FullyQualifiedErrorId : AccessDenied,Catch-MsGraphError

When it is not allowed to use service principals, for what is the option to Connect-AADAssessment -Certificate ...

Can someone help me?
Thanks
Arne

AppKeys and expiration

Hello all together,

I analyse the last assessment and I wonder why one app in my tenant is marked as expired. The App registration in this case has no certificate and no secret, so nothing can expire from my point of view.
What I see ist that the enddate is calculated, creation date plus two years and that is the expiration date.

Is this correct or is this an error?

Unable to find type [System.IO.Compression.ZipFile

Getting this error: Unable to find type [System.IO.Compression.ZipFile

Dumps from PS:

Exporting UserReport: Completed 78,906 in 00:13:31
Loading groups in lookup cache
Exporting NotificationsEmailsReport: Completed 85 in 00:00:06
Loading administrative units in lookup cache
Loading applications in lookup cache
Loading service principals in lookup cache
Exporting RoleAssignmentReport: Completed 1,232 in 00:00:15
Exporting AppCredentialsReport: Completed 18,856 in 00:02:36
Exporting ConsentGrantReport: Completed 49,738 in 00:05:36
WARNING: The export package has not been generated
WARNING: If you are working with microsoft or a provider on the assessment please warn them
WARNING: Please check GitHub issues and fill a new one or reply on existing ones mentionning the errors seen
WARNING: https://github.com/AzureAD/AzureADAssessment/issues
Unable to find type [System.IO.Compression.ZipFile].

Any solution for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.