Edit

Share via


Test-EntraScript

Checks if the provided script uses Azure AD commands compatible with the Microsoft Entra PowerShell module.

Syntax

Default (Default)

Test-EntraScript

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

Description

Checks if the provided script uses Azure AD commands compatible with the Microsoft Entra PowerShell module.

Examples

Example 1

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

Returns whether the script usercreation.ps1 could run under Microsoft.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.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).

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Path

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

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:FullName, Name

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-Quiet

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

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.