Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test-EntraScript not in v1.0.1 #1329

Open
diecknet opened this issue Jan 31, 2025 · 7 comments
Open

Test-EntraScript not in v1.0.1 #1329

diecknet opened this issue Jan 31, 2025 · 7 comments
Assignees
Labels
P0 Highest priority ToTriage

Comments

@diecknet
Copy link

Describe the bug

I installed the newest Microsoft.Entra Module bundle (version 1.0.1), but the cmdlet Test-EntraScript is not available. According to the documentation it should be included.
Docs:
https://learn.microsoft.com/en-us/powershell/entra-powershell/migration-guide?view=entra-powershell&wt.mc_id=MVP_330618#test-compatibility-with-test-entrascript-command
https://learn.microsoft.com/en-us/powershell/module/microsoft.entra/test-entrascript?view=entra-powershell&wt.mc_id=MVP_330618

Error message:

Test-EntraScript: The term 'Test-EntraScript' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

To Reproduce
Steps to reproduce the behavior:

  1. Install Microsoft.Entra
  2. Run Test-EntraScript (not working)
  3. Run other Cmdlets from the module e.g. Connect-Entra (working)

Expected behavior
The cmdlet should be included in the module

Debug Output
not applicable

Module Version

PS C:\> Get-Module Microsoft.Entra*

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Manifest   1.0.1                 Microsoft.Entra
Script     1.0.1                 Microsoft.Entra.Applications        {Add-EntraApplication…
Script     1.0.1                 Microsoft.Entra.Authentication      {Add-EntraEnvironment…
Script     1.0.1                 Microsoft.Entra.DirectoryManagement {Add-EntraAdministrat…
Script     1.0.1                 Microsoft.Entra.Governance          {Enable-EntraAzureADA…
Script     1.0.1                 Microsoft.Entra.Groups              {Add-EntraGroupMember…
Script     1.0.1                 Microsoft.Entra.Reports             {Enable-EntraAzureADA…
Script     1.0.1                 Microsoft.Entra.SignIns             {Enable-EntraAzureADA…
Script     1.0.1                 Microsoft.Entra.Users               {Enable-EntraAzureADA…

Environment Data

PS C:\> $PSversiontable

Name                           Value
----                           -----
PSVersion                      7.4.6
PSEdition                      Core
GitCommitId                    7.4.6
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Screenshots

Image

Additional context
none

@bmkaiser
Copy link

It doesn't appear that the Microsoft.Entra module has any cmdlets or functions whatsoever:

Image

@SamErde
Copy link
Collaborator

SamErde commented Jan 31, 2025

The Test-EntraScript function isn't mapped into the build process for the Microsoft.Entra module yet and therefore doesn't get delivered in the published build. (I don't know why, but the 'Migration' category that this is tagged in is specifically skipped.)

However, it does still exist in a standalone form that you can download (Test-EntraScript) and is also still in the legacy build of the Microsoft.Graph.Entra module.

@bmkaiser
Copy link

bmkaiser commented Feb 2, 2025

Thank you, @SamErde. I tried your suggestion of running the module manually. Do we know what the expected output is? I only tested with one script, but didn’t get any output. Then I tried with the -Quiet parameter and received $false.

I would assume some sort of output when not using -Quiet to tell me what issues exist within the script.

@SamErde
Copy link
Collaborator

SamErde commented Feb 2, 2025

The purpose of that specific function is only to: "check whether the provided script is using AzureAD commands that are not supported by Microsoft.Graph.Entra."

Per the function's help, the Quiet parameter hides the test output and only returns true or false as a result of the check. In this case, false should indicate that the script you tested does not use any unsupported commands.

@SamErde
Copy link
Collaborator

SamErde commented Feb 2, 2025

In addition to the documentation that you referenced earlier, there is a lot of useful information to be learned just by opening the script and reading the comment based help. 😀

	<#
	.SYNOPSIS
		Checks, whether the provided script is using AzureAD commands that are not supported by Microsoft.Graph.Entra.
	
	.DESCRIPTION
		Checks, whether the provided script is using AzureAD commands that are not supported by Microsoft.Graph.Entra.
	
	.PARAMETER Path
		Path to the script file(s) to scan.
		Or name of the content, when also specifying -Content

	.PARAMETER Content
		Code content to scan.
		Used when scanning code that has no file representation (e.g. straight from a repository).

	.PARAMETER Quiet
		Only return $true or $false, based on whether the script could run under Microsoft.Graph.Entra ($true) or not ($false)
	
	.EXAMPLE
		PS C:\> Test-EntraScript -Path .\usercreation.ps1 -Quiet
		
		Returns whether the script "usercreation.ps1" could run under Microsoft.Graph.Entra

	.EXAMPLE
		PS C:\> Get-ChildItem -Path \\contoso.com\it\code -Recurse -Filter *.ps1 | Test-EntraScript

		Returns a list of all scripts that would not run under the Microsoft.Graph.Entra module, listing each issue with line and code.
	#>

@KenitoInc KenitoInc added the P0 Highest priority label Feb 3, 2025
@KenitoInc
Copy link
Collaborator

Test-EntraScript needs to be added to all sub-modules and shipped as part of the sub-modules.

@bmkaiser
Copy link

bmkaiser commented Feb 4, 2025

In addition to the documentation that you referenced earlier, there is a lot of useful information to be learned just by opening the script and reading the comment based help. 😀

From the description of -Quiet:

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

That means that the script is not supported when returning $false. However, I wish I understood why it's not supported when running it without the -Quiet parameter. What cmdlets are causing the compatibility issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 Highest priority ToTriage
Projects
None yet
Development

No branches or pull requests

5 participants