Get-EntraBetaAgentIdentity
Gets an Agent Identity by its ID.
Syntax
Default (Default)
Get-EntraBetaAgentIdentity
-AgentId <String>
[<CommonParameters>]
Description
The Get-EntraBetaAgentIdentity cmdlet retrieves an Agent Identity from Microsoft Graph using the provided Agent ID. Returns the agent identity object if found, or throws an error if not found.
Examples
Example 1: Get an Agent Identity by ID
Connect-Entra -Scopes 'Application.Read.All'
Get-EntraBetaAgentIdentity -AgentId "27a3cf14-5bdc-4814-bb13-8f1740ca9a4f"
This example retrieves the Agent Identity with the specified ID.
Example 2: Get an Agent Identity with error handling
Connect-Entra -Scopes 'Application.Read.All'
try {
$agent = Get-EntraBetaAgentIdentity -AgentId "27a3cf14-5bdc-4814-bb13-8f1740ca9a4f"
Write-Host "Agent found: $($agent.displayName)"
} catch {
Write-Host "Agent not found or error occurred: $_"
}
This example demonstrates how to retrieve an Agent Identity with error handling to catch cases where the agent doesn't exist.
Parameters
-AgentId
The ID of the Agent Identity to retrieve.
Parameter properties
| Type: | System.String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| 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.
Inputs
None
Outputs
System.Object
Returns the Agent Identity object with properties including id, displayName, appId, and other agent identity details.
Notes
If the Agent Identity with the specified ID is not found, the cmdlet will throw an error.