Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
In omgevingen met beperkte internettoegang moet u mogelijk Microsoft Entra PowerShell-modules offline installeren. In dit artikel wordt uitgelegd hoe u de modules instelt en installeert met behulp van gedownloade pakketbestanden en een lokale opslagplaats.
Offline-installatie is handig in scenario's zoals:
- Air-gapped netwerken zonder internetverbinding
- Organisaties met strikt beveiligingsbeleid waarmee internettoegang wordt beperkt
- Omgevingen waar directe PowerShell Gallery toegang niet beschikbaar is
Prerequisites
Voordat u begint, moet u ervoor zorgen dat u het volgende heeft:
- PowerShell 5.1 of hoger (PowerShell 7+ aanbevolen)
- Beheerdersbevoegdheden op de doelcomputer
- Toegang tot downloadlocatie met internetverbinding om de vereiste bestanden te downloaden
- Ondertekende nupkg-bestanden van de releasepagina van Microsoft Entra PowerShell.
Overzicht van het offline-installatieproces
Het offline-installatieproces omvat de volgende hoofdstappen:
- Microsoft Graph PowerShell-afhankelijkheden installeren
- Een lokale PowerShell-opslagplaats instellen
- Nupkg-bestanden downloaden en plaatsen in de lokale opslagplaats
- Microsoft Entra modules installeren vanuit de lokale opslagplaats
Microsoft Graph PowerShell-afhankelijkheden installeren
Microsoft Entra PowerShell-modules zijn afhankelijk van specifieke Microsoft Graph PowerShell-modules. Deze afhankelijkheden worden automatisch geïnstalleerd bij de installatie vanaf de PowerShell Gallery, maar in offlinescenario's moet u ze handmatig installeren.
Important
U moet deze afhankelijkheden eerst installeren op een computer met internettoegang of de afhankelijkheidsmodules verkrijgen via de goedgekeurde softwaredistributiemethode van uw organisatie.
Voer het volgende script uit om de vereiste Microsoft Graph PowerShell-afhankelijkheden te installeren. Microsoft Entra PowerShell ondersteunt momenteel versie 2.25.0.
# Define the required Graph modules version
$graphModulesVersion = "2.25.0"
# List of required Graph modules
$graphModules = @(
"Microsoft.Graph.DirectoryObjects",
"Microsoft.Graph.Users",
"Microsoft.Graph.Users.Actions",
"Microsoft.Graph.Groups",
"Microsoft.Graph.Identity.DirectoryManagement",
"Microsoft.Graph.Identity.Governance",
"Microsoft.Graph.Identity.SignIns",
"Microsoft.Graph.Applications",
"Microsoft.Graph.Reports"
)
# Install each module
foreach ($moduleName in $graphModules) {
Write-Host "Installing Module $($moduleName)" -ForegroundColor Green
Install-Module $moduleName -Scope CurrentUser -RequiredVersion $graphModulesVersion -Force -AllowClobber -Verbose
}
Een lokale PowerShell-opslagplaats instellen
Maak een lokale PowerShell-opslagplaats waarin u de Microsoft Entra PowerShell-modulepakketten opslaat.
# Define local gallery settings $localGallery = '__LocalGallery__' $galleryPath = 'C:\LocalPowerShellGallery' # Create the gallery directory if it doesn't exist if (-not(Test-Path $galleryPath)) { Write-Host "Creating local gallery directory: $galleryPath" -ForegroundColor Yellow $null = New-Item -Path $galleryPath -ItemType Directory } # Register the local repository Write-Host "Registering local PowerShell repository: $localGallery" -ForegroundColor Green $null = Register-PSRepository -Name $localGallery -SourceLocation $galleryPath -ScriptSourceLocation $galleryPath -InstallationPolicy TrustedControleer of de lokale repository succesvol werd aangemaakt:
# Display all registered repositories Get-PSRepositoryDe uitvoer moet er ongeveer zo uitzien:
Name InstallationPolicy SourceLocation ---- ------------------ -------------- PSGallery Untrusted https://www.powershellgallery.com/api/v2 __LocalGallery__ Trusted C:\LocalPowerShellGallery
Nupkg-bestanden downloaden en plaatsen
Nupkg-bestanden downloaden
Navigeer naar de pagina Microsoft Entra PowerShell-releases op GitHub.
Kies de versie die u wilt installeren (bijvoorbeeld v1.0.11).
Download in de sectie Assets de vereiste nupkg-bestanden op basis van uw behoeften:
Alleen voor v1.0-modules:
Microsoft.Entra.1.0.11.nupkgMicrosoft.Entra.Applications.1.0.11.nupkgMicrosoft.Entra.Authentication.1.0.11.nupkgMicrosoft.Entra.CertificateBasedAuthentication.1.0.11.nupkgMicrosoft.Entra.DirectoryManagement.1.0.11.nupkgMicrosoft.Entra.Governance.1.0.11.nupkgMicrosoft.Entra.Groups.1.0.11.nupkgMicrosoft.Entra.Reports.1.0.11.nupkgMicrosoft.Entra.SignIns.1.0.11.nupkgMicrosoft.Entra.Users.1.0.11.nupkg
Voor bètamodules: Download de bijbehorende
.Beta.nupkg-bestanden als u bètafunctionaliteit nodig hebt.
Bestanden in lokale opslagplaats plaatsen
Kopieer alle gedownloade nupkg-bestanden naar uw lokale galeriemap:
# Copy nupkg files to the local gallery
# Replace 'C:\Downloads' with the actual path where you downloaded the files
$downloadPath = 'C:\Downloads'
$nupkgFiles = Get-ChildItem -Path $downloadPath -Filter "Microsoft.Entra*.nupkg"
foreach ($file in $nupkgFiles) {
Write-Host "Copying $($file.Name) to local gallery" -ForegroundColor Cyan
Copy-Item -Path $file.FullName -Destination $galleryPath -Force
}
Stap 4: Microsoft Entra PowerShell-modules installeren
Afzonderlijke modules installeren
U kunt modules afzonderlijk installeren op basis van uw specifieke behoeften:
# Install a specific module
Install-Module -Name 'Microsoft.Entra.Authentication' -Repository $localGallery -AllowClobber -Verbose
Alle modules installeren
Gebruik dit script om alle beschikbare Microsoft Entra modules te installeren:
# Define the modules to install
$entraModules = @(
"Microsoft.Entra.Authentication",
"Microsoft.Entra.Applications",
"Microsoft.Entra.DirectoryManagement",
"Microsoft.Entra.Groups",
"Microsoft.Entra.Governance",
"Microsoft.Entra.SignIns",
"Microsoft.Entra.Users",
"Microsoft.Entra.Reports",
"Microsoft.Entra.CertificateBasedAuthentication"
)
# Install each module from the local gallery
foreach ($moduleName in $entraModules) {
Write-Host "[Local Gallery] Installing: $moduleName" -ForegroundColor Green
Install-Module -Name $moduleName -Repository $localGallery -AllowClobber -Verbose
}
De hoofdmodule installeren (optioneel)
Nadat u de afhankelijke modules hebt geïnstalleerd, kunt u eventueel de hoofdmodule installeren:
Install-Module -Name 'Microsoft.Entra' -Repository $localGallery -AllowClobber -Verbose
Installatie verifiëren
Controleer of de modules zijn geïnstalleerd:
# Display all installed Microsoft Entra modules
Get-InstalledModule Microsoft.Entra.*
De uitvoer moet er ongeveer zo uitzien:
Version Name Repository Description
------- ---- ---------- -----------
1.0.11 Microsoft.Entra.Applications __LocalGallery__ Microsoft Entra PowerShell
1.0.11 Microsoft.Entra.Authentication __LocalGallery__ Microsoft Entra PowerShell
1.0.11 Microsoft.Entra.CertificateBasedAuthentication __LocalGallery__ Microsoft Entra PowerShell
1.0.11 Microsoft.Entra.DirectoryManagement __LocalGallery__ Microsoft Entra PowerShell
1.0.11 Microsoft.Entra.Governance __LocalGallery__ Microsoft Entra PowerShell
1.0.11 Microsoft.Entra.Groups __LocalGallery__ Microsoft Entra PowerShell
1.0.11 Microsoft.Entra.Reports __LocalGallery__ Microsoft Entra PowerShell
1.0.11 Microsoft.Entra.SignIns __LocalGallery__ Microsoft Entra PowerShell
1.0.11 Microsoft.Entra.Users __LocalGallery__ Microsoft Entra PowerShell
De installatie testen
Test of de modules correct werken door verbinding te maken met Microsoft Entra:
# Import the authentication module
Import-Module Microsoft.Entra.Authentication
# Connect to Microsoft Entra (this will require internet connectivity for authentication)
Connect-Entra
# Test with a simple command
Get-EntraContext
Opschonen (optioneel)
Registratie van de lokale opslagplaats ongedaan maken
Als u de lokale opslagplaats niet meer nodig hebt, kunt u de registratie ongedaan maken:
# Unregister the local repository
Unregister-PSRepository -Name $localGallery
Write-Host "Local repository '$localGallery' has been unregistered" -ForegroundColor Yellow
Lokale galeriemap verwijderen
De lokale galerie volledig verwijderen:
# Remove the local gallery folder and its contents
if (Test-Path $galleryPath) {
Remove-Item -Path $galleryPath -Recurse -Force
Write-Host "Local gallery folder removed: $galleryPath" -ForegroundColor Yellow
}
Troubleshooting
Veelvoorkomende problemen en oplossingen
| Issue | Oorzaak | Solution |
|---|---|---|
| De module is niet gevonden in de opslagplaats | nupkg-bestanden die niet naar de lokale galerie zijn gekopieerd | Controleren of bestanden zich in het juiste galeriepad bevinden |
| Afhankelijkheden niet geïnstalleerd | Graph PowerShell-modules ontbreken | Installeer eerst de vereiste Microsoft Graph PowerShell-modules |
| Toegang geweigerd | Onvoldoende machtigingen | PowerShell uitvoeren als beheerder |
| Repository is niet vertrouwd | Lokale opslagplaats die niet is gemarkeerd als vertrouwd | Parameter gebruiken -Force of installatiebeleid instellen op Vertrouwd |
Inhoud van lokale opslagplaats controleren
Ga als volgt te werk om te zien welke pakketten beschikbaar zijn in uw lokale opslagplaats:
# List all available packages in the local repository
Find-Module -Repository $localGallery
Moduleafhankelijkheden controleren
Als u wilt weten welke afhankelijkheden een module nodig heeft:
# Get module dependencies
Find-Module -Name "Microsoft.Entra.Users" -Repository $localGallery | Select-Object -ExpandProperty Dependencies