mirror of
https://github.com/Micke-K/IntuneManagement.git
synced 2026-11-27 09:22:26 +01:00
Development snapshot 2026-10-25 (4.0.0-beta1 + fixes)
This commit is contained in:
@@ -398,7 +398,10 @@ Start-IMGraphBulkExport -SettingsFile .\nightly-export.json
|
||||
### Start-IMGraphBulkImport
|
||||
|
||||
Import an export folder. Groups are processed in dependency order. Returns `Groups`,
|
||||
`Imported`, `Duration`.
|
||||
`Imported`, `Updated`, `Replaced`, `Skipped`, `PendingApproval`, `UnknownSelectors`,
|
||||
`Duration`. `PendingApproval` counts the creates and updates Multi Admin Approval held
|
||||
for a second administrator; they are queued, not failed, and their approval codes are
|
||||
in the log.
|
||||
|
||||
| Parameter | Type | Notes |
|
||||
|---|---|---|
|
||||
|
||||
@@ -63,6 +63,44 @@ Without `IM_UI_BACKEND`, the module defaults to the headless `None` backend off
|
||||
Windows - useful for automation, and the reason `Connect-IMIntuneManagement` and the
|
||||
bulk cmdlets work fine on a Mac or a Linux box with no display at all.
|
||||
|
||||
### macOS blocks the launcher
|
||||
|
||||
When the app was downloaded as a ZIP, the first start shows:
|
||||
|
||||
> **"Start-Avalonia.command" Not Opened**
|
||||
> Apple could not verify "Start-Avalonia.command" is free of malware that may harm your
|
||||
> Mac or compromise your privacy.
|
||||
|
||||
The buttons are **Move to Trash** and **Done** (or **OK**). Choose **Done**; nothing is
|
||||
wrong with the file.
|
||||
|
||||
Why: the browser marks every file it downloads with a quarantine flag, and macOS
|
||||
Gatekeeper refuses to run a flagged file that Apple has not notarized. This project is
|
||||
not notarized - that needs a paid Apple Developer account and a signed build of every
|
||||
file - so every file from the ZIP carries the flag. That includes the Avalonia libraries
|
||||
in `Bin/Avalonia` (`.dylib`), which would each be refused the same way once the launcher
|
||||
itself is allowed.
|
||||
|
||||
**Fix (recommended): clear the flag on the whole folder**, once, in Terminal:
|
||||
|
||||
```sh
|
||||
xattr -dr com.apple.quarantine /path/to/IntuneManagement
|
||||
```
|
||||
|
||||
Drag the folder onto the Terminal window to fill in the path. `-r` covers every file
|
||||
inside, so the launcher and all the native libraries start without further prompts.
|
||||
Extracting a new download brings the flag back, so run it again after each update.
|
||||
|
||||
**Alternative: allow it in System Settings.** Right after the block, open **System
|
||||
Settings > Privacy & Security**, scroll to **Security**, and select **Open Anyway** next
|
||||
to the message about `Start-Avalonia.command`. Confirm with your password. This allows
|
||||
only that one file; macOS may then block each native library in turn, so the `xattr`
|
||||
command above is less work. (Control-click > **Open** no longer bypasses the check on
|
||||
macOS 15 and later.)
|
||||
|
||||
**Avoid it entirely:** a `git clone` does not set the quarantine flag, and neither does
|
||||
copying the folder from another Mac over the network with `scp` or `rsync`.
|
||||
|
||||
## What does not work off Windows
|
||||
|
||||
These degrade with a log message rather than an error:
|
||||
@@ -72,6 +110,7 @@ These degrade with a log message rather than an error:
|
||||
| **Word documentation output** | Needs `Microsoft.Office.Interop.Word` COM automation. HTML, Markdown, CSV and JSON output are unaffected. |
|
||||
| **MSI property extraction** on app import | Needs the `WindowsInstaller.Installer` COM object. Other app types import normally. |
|
||||
| **WAM / broker sign-in** | Windows-only. Authentication falls back to the system browser. |
|
||||
| **File > Hide console** and the *Hide console window* setting | The process has no console window of its own off Windows - the terminal emulator is another application. The menu item is not shown and the setting does nothing. (On Windows it also needs the classic console host; under Windows Terminal the console cannot be hidden.) |
|
||||
|
||||
The `Default` theme follows the OS on all three platforms: the Windows app theme, the
|
||||
macOS appearance setting, and the GNOME colour scheme on Linux. Linux desktops that are
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
# Using your own Entra app registration
|
||||
|
||||
By default, interactive sign-in uses Microsoft's public **Microsoft Graph PowerShell**
|
||||
application (`14d82eec-204b-4c2f-b7e8-296a70dab67e`), so the tool works with no setup.
|
||||
This page explains how to create your own app registration and point the tool at it.
|
||||
|
||||
## When you need your own app
|
||||
|
||||
- **Unattended runs.** Scheduled tasks, pipelines and runbooks sign in with a client
|
||||
secret, a certificate or a federated credential. Those need an app you own.
|
||||
- **The OAuth provider.** It always signs in as an app you configure.
|
||||
- **Your tenant blocks Microsoft Graph PowerShell.** Some tenants require user
|
||||
assignment on that app or allow only approved apps. Sign-in then fails with
|
||||
`AADSTS65001` (no consent) or `AADSTS50105` (user not assigned).
|
||||
- **Narrower permissions or a clear audit trail.** Your own app carries exactly the
|
||||
permissions you grant, and sign-in logs show its name instead of Microsoft's.
|
||||
|
||||
## 1. Create the registration
|
||||
|
||||
In the [Microsoft Entra admin center](https://entra.microsoft.com):
|
||||
|
||||
1. Go to **Entra ID > App registrations > New registration**.
|
||||
2. Give it a name, for example *Intune Management*.
|
||||
3. Under **Supported account types**, pick *Accounts in this organizational directory
|
||||
only* unless you manage several tenants with one app.
|
||||
4. Under **Redirect URI**, choose **Public client/native (mobile & desktop)** and enter
|
||||
`http://localhost`.
|
||||
5. Select **Register**, then copy the **Application (client) ID** and the
|
||||
**Directory (tenant) ID** from the overview page.
|
||||
|
||||
Then open **Authentication** on the new app:
|
||||
|
||||
- Make sure `http://localhost` is listed under **Mobile and desktop applications**.
|
||||
Interactive sign-in runs in the system browser, and that is the only redirect a
|
||||
browser can return to. On macOS and Linux it is the only option at all.
|
||||
- Set **Allow public client flows** to **Yes**. Device code sign-in (`-DeviceCode`)
|
||||
and the OAuth provider's username/password flow need it.
|
||||
- Only if you turn on **Use Web Account Manager (WAM) for login** in Settings: also add
|
||||
`ms-appx-web://microsoft.aad.brokerplugin/<application id>` as a redirect URI under
|
||||
**Mobile and desktop applications**.
|
||||
|
||||
## 2. Add API permissions
|
||||
|
||||
Open **API permissions > Add a permission > Microsoft Graph**.
|
||||
|
||||
- Pick **Delegated permissions** for people signing in interactively.
|
||||
- Pick **Application permissions** for unattended runs.
|
||||
|
||||
Add the permissions for the parts of Intune you manage. With all of them, every
|
||||
policy type can be read and changed:
|
||||
|
||||
```
|
||||
DeviceManagementConfiguration.ReadWrite.All DeviceManagementApps.ReadWrite.All
|
||||
DeviceManagementServiceConfig.ReadWrite.All DeviceManagementScripts.ReadWrite.All
|
||||
DeviceManagementRBAC.ReadWrite.All Policy.ReadWrite.ConditionalAccess
|
||||
Agreement.ReadWrite.All Organization.ReadWrite.All
|
||||
CloudPC.ReadWrite.All Group.ReadWrite.All
|
||||
```
|
||||
|
||||
- `Group.ReadWrite.All` is what lets a cross-tenant import create the groups a policy
|
||||
is assigned to. `Group.Read.All` is enough if you never import into another tenant.
|
||||
- For a read-only identity, grant the `.Read.All` variant of each permission instead.
|
||||
The left-hand menu then marks the types that identity cannot change.
|
||||
- For delegated sign-in, keep the `User.Read` permission that a new registration
|
||||
already has. The tool reads the signed-in user's name and photo.
|
||||
|
||||
Then select **Grant admin consent for \<tenant\>**. The tool asks Entra for every
|
||||
permission the app has been granted (the `.default` scope), so a permission that is
|
||||
added but not consented is simply missing from the token.
|
||||
|
||||
For delegated sign-in, the user also needs an Intune role that allows the action. The
|
||||
app's permissions are the upper limit; the user's role decides within it. See
|
||||
[Effective permissions](EffectivePermissions.md).
|
||||
|
||||
## 3. Add a credential (unattended runs only)
|
||||
|
||||
Under **Certificates & secrets**, either:
|
||||
|
||||
- **Upload a certificate** (recommended). Keep the private key in the certificate store
|
||||
of the machine that runs the job, or in a `.pfx` file.
|
||||
- **Add a client secret.** Copy the value when it is shown; Entra never shows it again.
|
||||
Secrets expire, so note the date.
|
||||
|
||||
Interactive and device code sign-in need no credential.
|
||||
|
||||
## 4. Use the app in the tool
|
||||
|
||||
### In the app's Settings
|
||||
|
||||
Open **Settings > Authentication** and fill in:
|
||||
|
||||
| Setting | Value |
|
||||
|---|---|
|
||||
| Entra application | Leave **empty**. A built-in app selected here wins over your own. |
|
||||
| Application Id | The **Application (client) ID** from step 1. |
|
||||
| Tenant Id | The **Directory (tenant) ID**. Required for a single-tenant app: without it, sign-in goes to the multi-tenant endpoint and Entra refuses a single-tenant app there. |
|
||||
| Redirect URL | Leave empty. The system browser always uses `http://localhost`. |
|
||||
| Authority | Leave empty, unless you have been told to use a specific authority URL. |
|
||||
|
||||
Sign out, then sign in again. The new app is used from the next sign-in.
|
||||
|
||||
### From PowerShell
|
||||
|
||||
The same settings, saved:
|
||||
|
||||
```powershell
|
||||
Import-Module .\IntuneManagement.psd1
|
||||
Set-IMSetting -Key EntraCustomAppId -Value '<application id>'
|
||||
Set-IMSetting -Key EntraCustomTenantId -Value '<tenant id>'
|
||||
Connect-IMIntuneManagement -Interactive
|
||||
```
|
||||
|
||||
Or for one sign-in only, without saving anything:
|
||||
|
||||
```powershell
|
||||
Connect-IMIntuneManagement -Interactive -TenantId '<tenant id>' -AppId '<application id>'
|
||||
Connect-IMIntuneManagement -DeviceCode -TenantId '<tenant id>' -AppId '<application id>'
|
||||
```
|
||||
|
||||
Unattended, with the credential from step 3:
|
||||
|
||||
```powershell
|
||||
# Certificate by thumbprint (CurrentUser\My, then LocalMachine\My)
|
||||
Connect-IMIntuneManagement -TenantId '<tenant id>' -AppId '<application id>' -Certificate '<thumbprint>'
|
||||
|
||||
# Certificate from a .pfx file
|
||||
Connect-IMIntuneManagement -TenantId '<tenant id>' -AppId '<application id>' `
|
||||
-CertificatePath C:\certs\intune.pfx -CertificatePassword (Read-Host -AsSecureString)
|
||||
|
||||
# Client secret - read it from a vault or a pipeline secret, never from the script
|
||||
Connect-IMIntuneManagement -TenantId '<tenant id>' -AppId '<application id>' -Secret $env:INTUNE_APP_SECRET
|
||||
|
||||
# Workload identity federation (GitHub Actions, AKS), OAuth provider
|
||||
Connect-IMIntuneManagement -Provider OAuth -TenantId '<tenant id>' -AppId '<application id>' `
|
||||
-FederatedTokenFile $env:AZURE_FEDERATED_TOKEN_FILE
|
||||
```
|
||||
|
||||
For workload identity federation, add the matching federated credential to the app
|
||||
under **Certificates & secrets > Federated credentials** instead of a secret.
|
||||
|
||||
To open the window signed in as the app instead of a user, connect first and then run
|
||||
`Show-IMMainWindow`. The full recipe, with the secret read from a vault, is in
|
||||
[Examples](Examples.md#open-the-window-signed-in-as-an-app).
|
||||
|
||||
### Government clouds
|
||||
|
||||
Register the app in the government tenant itself: the Microsoft Entra admin center for
|
||||
US Government is [entra.microsoft.us](https://entra.microsoft.us). Then add `-Cloud` to
|
||||
every connect - `USGov` for GCC High, `USGovDOD` for DoD - or set **Settings >
|
||||
Authentication > Default cloud** for interactive sign-in. GCC (commercial) tenants use
|
||||
the public cloud and need nothing extra.
|
||||
|
||||
Without the right cloud, an app sign-in to a GCC High tenant fails with
|
||||
`AADSTS900382: Confidential Client is not supported in Cross Cloud request`.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Error | Cause | Fix |
|
||||
|---|---|---|
|
||||
| `AADSTS50011` redirect URI mismatch | `http://localhost` is missing from the registration | Add it under **Authentication > Mobile and desktop applications** |
|
||||
| `AADSTS65001` user or administrator has not consented | Permissions were added but not consented, or the tenant does not allow user consent | Select **Grant admin consent** on the app's API permissions |
|
||||
| `AADSTS50194` application is not configured as multi-tenant | A single-tenant app was used without a tenant | Fill in **Tenant Id** in Settings, or pass `-TenantId` |
|
||||
| `AADSTS7000218` request body must contain client_assertion or client_secret | Device code or username/password sign-in on an app that does not allow public client flows | Set **Allow public client flows** to **Yes** |
|
||||
| `AADSTS700016` application not found in the directory | Wrong application id, or the app lives in another tenant | Check the id; for a single-tenant app, sign in to the tenant that owns it |
|
||||
| Menu items marked as read-only, or 403 errors | The token lacks a write permission | Add the `.ReadWrite.All` permission and consent again, then sign out and back in |
|
||||
|
||||
When something else fails, the log names the cause. Turn on the **Debug** setting
|
||||
for more detail, and the MSAL log (`msal.log` in the app data folder) records the full
|
||||
sign-in exchange.
|
||||
@@ -252,7 +252,10 @@ Start-IMGraphBulkDocumentation -OutputFormat html -PolicyGroup Compliance -Langu
|
||||
A policy is documented by the first of these that claims it:
|
||||
|
||||
1. A **handler** for its exact `@odata.type` (Conditional Access, Named Locations,
|
||||
Scope Tags, Role Definitions, Policy Sets, Kiosk, custom OMA-URI, ...).
|
||||
Scope Tags, Role Definitions, Policy Sets, Kiosk, custom OMA-URI, Reusable Settings, ...).
|
||||
Reusable settings (firewall dynamic keyword addresses, Device Control groups, the
|
||||
Linux compliance script) are walked against the schema Graph publishes for them, so
|
||||
each list of items comes out as a table with the portal's column names.
|
||||
2. An **input provider**: Settings Catalog policies walk their setting definitions;
|
||||
administrative templates their definition values; endpoint security intents their
|
||||
templates; Linux compliance its settings; and the profile providers use the
|
||||
|
||||
+41
-2
@@ -30,13 +30,52 @@ Connect-IMIntuneManagement -TenantId $tid -AppId $appId -CertificatePath .\auth.
|
||||
# Device code (headless box, sign in from another device)
|
||||
Connect-IMIntuneManagement -DeviceCode
|
||||
|
||||
# Sovereign clouds
|
||||
Connect-IMIntuneManagement -Cloud USGov -GCCType High -DefaultToken
|
||||
# Sovereign clouds: USGov = GCC High, USGovDOD = DoD, China = 21Vianet.
|
||||
# GCC (commercial) is Public, the default.
|
||||
Connect-IMIntuneManagement -Cloud USGov -TenantId $tid -AppId $appId -Secret $secret -DefaultToken
|
||||
```
|
||||
|
||||
Several tenants can be connected at once; each connect returns a token whose
|
||||
`Id` you pass as `-TokenId` to target that tenant.
|
||||
|
||||
## Open the window signed in as an app
|
||||
|
||||
4.0 never stores an app secret (3.x saved it in Settings, in clear text). Sign in from
|
||||
PowerShell, then open the window; it uses that sign-in. Read the secret from a vault at
|
||||
start, never from the script itself.
|
||||
|
||||
```powershell
|
||||
Import-Module C:\Tools\IntuneManagement\IntuneManagement.psd1
|
||||
|
||||
$tenantId = '<tenant id>'
|
||||
$appId = '<application id>'
|
||||
|
||||
# Option 1: a certificate - no secret to store at all (CurrentUser\My or LocalMachine\My)
|
||||
Connect-IMIntuneManagement -TenantId $tenantId -AppId $appId -Certificate '<thumbprint>'
|
||||
|
||||
# Option 2: a secret from a SecretManagement vault (Microsoft.PowerShell.SecretManagement
|
||||
# plus a registered vault, e.g. Microsoft.PowerShell.SecretStore)
|
||||
$secret = Get-Secret -Name IntuneAppSecret -AsPlainText
|
||||
Connect-IMIntuneManagement -TenantId $tenantId -AppId $appId -Secret $secret
|
||||
|
||||
# Option 3: a secret from Azure Key Vault (Az.KeyVault; sign in to Azure first, with
|
||||
# Connect-AzAccount -Environment AzureUSGovernment for a GCC High vault)
|
||||
$secret = Get-AzKeyVaultSecret -VaultName contoso-kv -Name IntuneAppSecret -AsPlainText
|
||||
Connect-IMIntuneManagement -TenantId $tenantId -AppId $appId -Secret $secret
|
||||
|
||||
# GCC High / DoD: add -Cloud USGov or -Cloud USGovDOD to the connect line
|
||||
|
||||
Show-IMMainWindow
|
||||
```
|
||||
|
||||
Save it as a `.ps1` and start it with `powershell -File` (Windows PowerShell 5.1) or
|
||||
`pwsh -STA -File` (PowerShell 7). This opens the WPF window on Windows. On macOS the
|
||||
window can only be started by `Start-Avalonia.command`, so use the commands above
|
||||
without `Show-IMMainWindow` for scripted work there.
|
||||
|
||||
The app registration needs application permissions with admin consent - see
|
||||
[Custom Entra app](CustomEntraApp.md).
|
||||
|
||||
## Settings
|
||||
|
||||
```powershell
|
||||
|
||||
@@ -5,7 +5,7 @@ dialog. **Setting** is the name shown in the dialog; **Key** is what `Get-IMSett
|
||||
`Set-IMSetting` and a settings file use. Where values are stored and how tenant and global
|
||||
values combine is in [Settings.md](Settings.md).
|
||||
|
||||
**Generated** by `Tools/Export-SettingsReference.ps1` from `Get-IMSettingDefinition` - do not edit by hand. 83 settings.
|
||||
**Generated** by `Tools/Export-SettingsReference.ps1` from `Get-IMSettingDefinition` - do not edit by hand. 84 settings.
|
||||
|
||||
A runbook settings file for `Import-IMSettingsStore` is a json object keyed by these names:
|
||||
|
||||
@@ -16,7 +16,7 @@ A runbook settings file for `Import-IMSettingsStore` is a json object keyed by t
|
||||
## Contents
|
||||
|
||||
- [Authentication](#authentication) (8)
|
||||
- [General](#general) (13)
|
||||
- [General](#general) (14)
|
||||
- [Import/Export](#importexport) (30)
|
||||
- [Intune](#intune) (8)
|
||||
- [Intune Tools](#intune-tools) (1)
|
||||
@@ -46,6 +46,7 @@ A runbook settings file for `Import-IMSettingsStore` is a json object keyed by t
|
||||
| Debug | `Debug` | Boolean | `false` | |
|
||||
| Environment color | `EnvironmentColor` | List | | Background color of the environment badge. Text color is auto-calculated for contrast. |
|
||||
| Environment name | `EnvironmentText` | Text | | Label shown as a badge in the toolbar (e.g. Production, Lab). Leave empty to hide. |
|
||||
| Hide console window | `HideConsoleWindow` | Boolean | `false` | Hide the console window the application was started from once the main window is showing. File > Hide console / Show console toggles it for the session. Windows only, and only for the classic console host: under Windows Terminal the console cannot be hidden and the menu item is not shown. |
|
||||
| Hide experimental platform notice | `HideExperimentalPlatformNotice` | Boolean | `false` | Stop showing the startup notice that macOS and Linux support is experimental. Clear this to see it again. |
|
||||
| Hide No-access items | `HideNoAccess` | Boolean | `false` | Remove items from the menu if object permissions is missing. Default is to mark them with red |
|
||||
| Log file | `LogFile` | File | | |
|
||||
@@ -97,8 +98,8 @@ A runbook settings file for `Import-IMSettingsStore` is a json object keyed by t
|
||||
| App download folder | `IntuneAppDownloadFolder` | Folder | | Folder where app packages will be downloaded and where encryption files will be saved |
|
||||
| App packages folder | `IntuneAppPackagesFolder` | Folder | | Root folder where intune app packages are located |
|
||||
| Get all pages | `GetAllPages` | Boolean | `true` | Get all pages when getting items in the UI. Note: This can take long time in environments with lots of policies and apps. |
|
||||
| Graph Page Size | `GraphPageSize` | List | `0` | How many items load at a time Values: `Graph Default`, `5`, `20`, `50`, `100`, `1000`, `All`. |
|
||||
| Max characters per cell | `ObjectListMaxCellLength` | Int | `50` | With single-line values on, cut a cell's text at this many characters so one long description cannot push the other columns out of view. Hover the cell for the full text; sorting and the filter still use the whole value. 0 = no limit. |
|
||||
| Graph Page Size | `GraphPageSize` | List | `0` | How many items load at a time. All loads every page in one go. Values: `Graph Default`, `5`, `20`, `50`, `100`, `1000`, `All`. |
|
||||
| Max characters per cell | `ObjectListMaxCellLength` | Int | `50` | With single-line values on, cut a cell's text at this many characters so one long description cannot push the other columns out of view. The Name column is never cut; it trims at the column edge. Hover the cell for the full text; sorting and the filter still use the whole value. 0 = no limit. |
|
||||
| Menu Object Type | `ObjectViewType` | List | `Group` | Specify object type for the menu. Group: Groups items together like the portal. Type - Single item based on API. Some APIs are split into multiple menu items. Values: `Group`, `Type (API)`. |
|
||||
| Save Encryption File | `IntuneSaveEncryptionFile` | Boolean | | Save encryption file when uploading an app. This can then be used to when downloading the app file. |
|
||||
| Single-line values in object list | `ObjectListFirstLineOnly` | Boolean | `true` | Show only the first line of multi-line values (e.g. store app descriptions) in the object list, so every row is one line high. Hover a cell for the full text. Takes effect when the list is next loaded. |
|
||||
|
||||
Reference in New Issue
Block a user