Observação
O acesso a essa página exige autorização. Você pode tentar entrar ou alterar diretórios.
O acesso a essa página exige autorização. Você pode tentar alterar os diretórios.
O exemplo de script do PowerShell lista informações sobre todos os grupos de conectores de rede privada do Microsoft Entra com os aplicativos atribuídos.
Caso você não tenha uma assinatura do Azure, crie uma conta gratuita do Azure antes de começar.
Observação
Recomendamos que você use o módulo do Az PowerShell do Azure para interagir com o Azure. Consulte Instalar o Azure PowerShell para começar. Para saber como migrar para o módulo Az PowerShell, confira Migrar o Azure PowerShell do AzureRM para o Az.
O exemplo requer o módulo 2.10 ou mais recente do Microsoft Graph Beta PowerShell .
Exemplo de script
# This sample script gets all Microsoft Entra private network connector groups with the assigned applications.
#
# Version 1.0
#
# This script requires PowerShell 5.1 (x64) or beyond and one of the following modules:
#
# Microsoft.Graph.Beta ver 2.10 or newer
#
# Before you begin:
#
# Required Microsoft Entra role at least Application Administrator or Application Developer
# or appropriate custom permissions as documented https://learn.microsoft.com/azure/active-directory/roles/custom-enterprise-app-permissions
#
#
Import-Module Microsoft.Graph.Beta.Applications
Connect-MgGraph -Scope Directory.Read.All -NoWelcome
Write-Host "Reading service principals. This operation might take longer..." -BackgroundColor "Black" -ForegroundColor "Green"
$aadapServPrinc = Get-MgBetaServicePrincipal -Top 100000 | where-object {$_.Tags -Contains "WindowsAzureActiveDirectoryOnPremApp"}
Write-Host "Reading Microsoft Entra applications. This operation might take longer..." -BackgroundColor "Black" -ForegroundColor "Green"
$allApps = Get-MgBetaApplication -Top 100000
Write-Host "Reading application. This operation might take longer..." -BackgroundColor "Black" -ForegroundColor "Green"
$aadapApp = $aadapServPrinc | ForEach-Object {$allApps.AppId -match $_.AppId}
Write-Host "Reading connector groups. This operation might take longer..." -BackgroundColor "Black" -ForegroundColor "Green"
$aadapConnectorGroups= Get-MgBetaOnPremisePublishingProfileConnectorGroup -OnPremisesPublishingProfileId "applicationProxy" -Top 100000
Write-Host "Displaying connector groups and assigned applications..." -BackgroundColor "Black" -ForegroundColor "Green"
Write-Host " "
foreach ($item in $aadapConnectorGroups)
{
If ($item.ConnectorGroupType -eq "applicationProxy")
{
"Connector group: " + $item.Name + " (Id: " + $item.Id+ ") - Region: " + $item.Region;
$assignedApps= Get-MgBetaOnPremisePublishingProfileConnectorGroupApplication -ConnectorGroupId $item.Id -OnPremisesPublishingProfileId "applicationProxy";
" ";
foreach ($item2 in $assignedApps)
{
$Item2.DisplayName + " (AppId: " + $item2.AppId+ ")"
}
" ";
}
}
Write-Host ("")
Write-Host ("Finished.") -BackgroundColor "Black" -ForegroundColor "Green"
Write-Host "To disconnect from Microsoft Graph, please use the Disconnect-MgGraph cmdlet."
Explicação do script
| Comando | Anotações |
|---|---|
| Connect-MgGraph | Conecta-se ao Microsoft Graph |
| Get-MgBetaServicePrincipal | Obtém uma entidade de serviço |
| Get-MgBetaApplication | Obtém um aplicativo empresarial |
| Get-MgBetaOnPremisePublishingProfileConnectorGroup | Obtenção de um grupo de conectores |
| Get-MgBetaOnPremisePublishingProfileConnectorGroupApplication | Obtém aplicativos atribuídos a um grupo de conectores |