Test-EntraScript

Check whether the provided script uses AzureAD commands not supported by Microsoft Entra PowerShell.

Syntax

Test-EntraScript
    [-Path] <String[]>
    [[-Content] <String>]
    [-Quiet]
    [<CommonParameters>]

Description

Check whether the provided script uses AzureAD commands not supported by Microsoft Entra PowerShell.

Examples

Example 1

Test-EntraScript -Path .\usercreation.ps1 -Quiet

Returns whether the script "usercreation.ps1" could run under Microsoft.Graph.Entra

Example 2

Get-ChildItem -Path \\contoso.com\it\code -Recurse -Filter *.ps1 | Test-EntraScript

Returns a list of all scripts that wouldn't run under the Microsoft.Graph.Entra module, listing each issue with line and code.

Parameters

-Content

Code content to scan. Used when scanning code that has no file representation (for example, straight from a repository).

Type:String
Position:2
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Path

Path to one or more script files to scan. Or name of the content, when also specifying -Content

Type:String[]
Aliases:FullName, Name
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Quiet

Only return $true or $ false, based on whether the script could run under Microsoft.Graph.Entra ($true) or not ($ false)

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False