msec
0.3.0
Minimum PowerShell version
7.0
Installation Options
Owners
Copyright
(c) 2026 Anton Lindström. Licensed under the MIT License.
Package Details
Author(s)
- Anton Lindstrom
Tags
MicrosoftSecurity Security SecureScore Defender DefenderXDR ExposureManagement Entra EntraID AzureAD ConditionalAccess MFA PIM PrivilegedAccess Intune MDM Compliance Azure ExchangeOnline SharePointOnline MicrosoftTeams Teams Microsoft365 KeyVault Graph Audit Posture CrossPlatform Windows Linux macOS
Functions
New-MsecApp Connect-Msec Disconnect-Msec Connect-MsecGraphSdk Connect-MsecExchangeOnline Connect-MsecSharePointOnline Connect-MsecTeams Get-MsecSecureScore Get-MsecAzureCost Get-MsecAzureRoleAssignment Get-MsecAzureSecureScore Get-MsecDefenderScoreExposure Get-MsecDefenderScoreDeviceConfiguration Get-MsecDefenderDevice Get-MsecDefenderEmailStats Get-MsecDefenderIncidentStats Get-MsecKeyVaultCertificate Get-MsecIntuneConfigurationProfile Get-MsecIntuneCompliancePolicy Get-MsecIntuneDevice Get-MsecIntuneScriptResult Get-MsecEntraConditionalAccessPolicy Get-MsecEntraConditionalAccessSignInLog Get-MsecEntraConditionalAccessStats Get-MsecEntraTenantSecuritySetting Get-MsecExchangeMailboxPermission Get-MsecSharePointSite Get-MsecTeamsPolicy Get-MsecSharePointSiteUser Get-MsecSharePointTenantSetting Get-MsecEntraGroupMember Get-MsecEntraLicense Get-MsecEntraRoleHolder Get-MsecEntraAppCredential Get-MsecEntraMfaRegistration Get-MsecEntraMfaEvidence Get-MsecEntraMfaRegistrationStats Get-MsecEntraDisabledUser Convert-MsecEntraSid Search-MsecAzureResourceGraph Search-MsecLogAnalytics Invoke-MsecAzureVMScript Select-MsecAzureContext Get-MsecAzureDevOpsServiceConnection Get-MsecAzureDevOpsOrganizationPolicy Get-MsecAzureDevOpsUser Export-MsecPostureReport Export-MsecVMUpdateReport Export-MsecVMNtpReport Export-MsecEntraDisabledUserReport Export-MsecDefenderDeviceReport Export-MsecEntraGroupMemberReport
Dependencies
Release Notes
v0.3.0
- Microsoft Teams: Connect-MsecTeams and Get-MsecTeamsPolicy - external access and federation,
guest access, meeting lobby and anonymous join, recording, app installation, and file sharing
in chats with external users. One row per SETTING, so policies diff between tenants.
- SharePoint: Get-MsecSharePointTenantSetting reads the tenant-wide sharing posture that no
per-site review can show - sharing capability, domain allow/block lists, legacy auth.
- Azure DevOps: Get-MsecAzureDevOpsUser (users and their group memberships, paginated) and
Get-MsecAzureDevOpsOrganizationPolicy (guest access, third-party OAuth, SSH, public projects).
- Connect-MsecTeams -AsCurrentUser borrows the Azure session, because the Teams module cannot
sign in interactively off Windows and Conditional Access refuses device code flow.
- New-MsecApp: -Workload Teams, and -ExchangeDirectoryRole is now -DirectoryRole (the old name
still works). -Workload SharePoint also grants SharePointTenantSettings.Read.All.
- Azure RBAC: Get-MsecAzureRoleAssignment across every subscription, with role and principal
names resolved and deleted principals kept rather than dropped.
- FIXED ON LINUX: the module folder and manifest are lowercase, matching the Gallery id. Before
this, Install-Module created msec/<version>/Msec.psd1 and Import-Module failed on Linux with
"no valid module file was found in any module directory" - a module that installed fine and
could not be loaded. macOS and Windows were unaffected.
- The Azure DevOps commands are now named Get-MsecAzureDevOps* rather than Get-MsecAdo*.
Get-MsecAdoServiceConnection from 0.2.0 is renamed; there is no alias.
v0.2.0
- Exchange Online and SharePoint Online: mailbox permissions, site inventory, and site
owners/members with security groups expanded to the people inside them.
- Bridges that let the Microsoft.Graph SDK, ExchangeOnlineManagement and PnP.PowerShell
run as the msec app without the certificate's private key reaching the machine.
- Azure: unused resources, network exposure across twelve resource types, Key Vault
certificate expiry, Cost Management, App Service inventory and stack settings.
- Entra: group members (nested groups expanded, PIM-eligible included), app registration
and service principal credential expiry.
- Defender: device inventory with per-device vulnerability counts.
- Evidence reports for Defender devices and Entra group membership; the posture report
gained privileged access, device platform and OS release measurements.
- New-MsecApp -Workload Exchange, SharePoint grants those workloads' permissions. Exchange
additionally needs a DIRECTORY ROLE - an app role alone is not enough, and without one
every Exchange call fails with an authorisation error that names nothing.
v0.1.0
- First release. Read-only Microsoft security posture as flat objects: Secure Score,
Defender XDR, Entra ID (roles, Conditional Access, MFA, licensing), Intune and Azure.
- Certificate-based auth against an app registration; the private key stays in Azure
Key Vault and signing happens there.
See CHANGELOG.md for full version history.
FileList
- msec.nuspec
- kql\Graph\AppGateway\All.kql
- kql\Graph\AppGateway\Backends.kql
- kql\Graph\AppGateway\Sites.kql
- kql\Graph\AppService\All.kql
- kql\Graph\AppService\StackSettings.kql
- kql\Graph\Authorization\RoleAssignments.kql
- kql\Graph\KeyVault\All.kql
- kql\Graph\KeyVault\NetworkRules.kql
- kql\Graph\LogAnalytics\All.kql
- kql\Graph\MySQL\All.kql
- kql\Graph\NSG\All.kql
- kql\Graph\NSG\SecurityRules.kql
- kql\Graph\Policy\All.kql
- kql\Graph\Policy\Compliance.kql
- kql\Graph\Policy\DiagnosticSettings.kql
- kql\Graph\Resource\All.kql
- kql\Graph\Resource\Inventory.kql
- kql\Graph\Resource\NetworkExposure.kql
- kql\Graph\Resource\Unused.kql
- kql\Graph\Storage\All.kql
- kql\Graph\Storage\NetworkRules.kql
- kql\Graph\VM\All.kql
- kql\Graph\VM\LastUpdated.kql
- kql\Graph\VM\PendingUpdates.kql
- kql\Graph\VM\UpdateReadiness.kql
- kql\Graph\Waf\All.kql
- kql\Graph\Waf\CustomRules.kql
- kql\Graph\Waf\Exclusions.kql
- kql\Graph\Waf\ManagedRules.kql
- kql\Law\VM\All.kql
- kql\Law\VM\Heartbeat.kql
- kql\Law\VM\SecurityEvents.kql
- kql\Law\VM\Syslog.kql
- kql\Law\VM\WindowsEvents.kql
- kql\Law\Waf\All.kql
- kql\Law\Waf\TopRules.kql
- msec.format.ps1xml
- msec.psd1
- msec.psm1
- private\Add-MsecExcelDashboard.ps1
- private\Add-MsecExcelRow.ps1
- private\Assert-MsecExcelWorkbook.ps1
- private\Assert-MsecSession.ps1
- private\Confirm-MsecEvidenceOverwrite.ps1
- private\ConvertTo-MsecAssignmentTarget.ps1
- private\ConvertTo-MsecBase64Url.ps1
- private\ConvertTo-MsecDeviceOsRelease.ps1
- private\ConvertTo-MsecExcelColumn.ps1
- private\ConvertTo-MsecExcelSheetName.ps1
- private\ConvertTo-MsecRolePrincipalRow.ps1
- private\Get-MsecAccessToken.ps1
- private\Get-MsecCachePath.ps1
- private\Get-MsecCertificateMetadata.ps1
- private\Get-MsecEnvironment.ps1
- private\Get-MsecExcelHeader.ps1
- private\Get-MsecExcelRowCount.ps1
- private\Get-MsecGraphCacheName.ps1
- private\Get-MsecGraphErrorMessage.ps1
- private\Get-MsecPolicyStatus.ps1
- private\Get-MsecPrincipalDisplayKey.ps1
- private\Get-MsecPrincipalObjectType.ps1
- private\Get-MsecPrivilegedRoleTemplate.ps1
- private\Get-MsecSettingsCatalogStatusReport.ps1
- private\Get-MsecSubscriptionList.ps1
- private\Get-MsecTenantProfile.ps1
- private\Invoke-MsecAzureDevOpsRequest.ps1
- private\Invoke-MsecAzureVMScriptCore.ps1
- private\Invoke-MsecDefenderRequest.ps1
- private\Invoke-MsecGraphRequest.ps1
- private\Invoke-MsecKeyVaultSign.ps1
- private\New-MsecClientAssertion.ps1
- private\New-MsecGroupMemberRow.ps1
- private\Read-MsecCache.ps1
- private\Resolve-MsecAzureVMScriptDispatch.ps1
- private\Resolve-MsecEvidenceSheet.ps1
- private\Resolve-MsecSubscription.ps1
- private\Save-MsecCache.ps1
- private\Save-MsecTenantProfile.ps1
- private\Test-MsecPrincipalUnnamed.ps1
- private\Write-MsecEvidenceWorkbook.ps1
- private\Write-MsecExcelSheet.ps1
- private\Write-MsecExcelTable.ps1
- private\Write-MsecVMEvidenceWorkbook.ps1
- public\Connect-Msec.ps1
- public\Connect-MsecExchangeOnline.ps1
- public\Connect-MsecGraphSdk.ps1
- public\Connect-MsecSharePointOnline.ps1
- public\Connect-MsecTeams.ps1
- public\Convert-MsecEntraSid.ps1
- public\Disconnect-Msec.ps1
- public\Export-MsecDefenderDeviceReport.ps1
- public\Export-MsecEntraDisabledUserReport.ps1
- public\Export-MsecEntraGroupMemberReport.ps1
- public\Export-MsecPostureReport.ps1
- public\Export-MsecVMNtpReport.ps1
- public\Export-MsecVMUpdateReport.ps1
- public\Get-MsecAzureCost.ps1
- public\Get-MsecAzureDevOpsOrganizationPolicy.ps1
- public\Get-MsecAzureDevOpsServiceConnection.ps1
- public\Get-MsecAzureDevOpsUser.ps1
- public\Get-MsecAzureRoleAssignment.ps1
- public\Get-MsecAzureSecureScore.ps1
- public\Get-MsecDefenderDevice.ps1
- public\Get-MsecDefenderEmailStats.ps1
- public\Get-MsecDefenderIncidentStats.ps1
- public\Get-MsecDefenderScoreDeviceConfiguration.ps1
- public\Get-MsecDefenderScoreExposure.ps1
- public\Get-MsecEntraAppCredential.ps1
- public\Get-MsecEntraConditionalAccessPolicy.ps1
- public\Get-MsecEntraConditionalAccessSignInLog.ps1
- public\Get-MsecEntraConditionalAccessStats.ps1
- public\Get-MsecEntraDisabledUser.ps1
- public\Get-MsecEntraGroupMember.ps1
- public\Get-MsecEntraLicense.ps1
- public\Get-MsecEntraMfaEvidence.ps1
- public\Get-MsecEntraMfaRegistration.ps1
- public\Get-MsecEntraMfaRegistrationStats.ps1
- public\Get-MsecEntraRoleHolder.ps1
- public\Get-MsecEntraTenantSecuritySetting.ps1
- public\Get-MsecExchangeMailboxPermission.ps1
- public\Get-MsecIntuneCompliancePolicy.ps1
- public\Get-MsecIntuneConfigurationProfile.ps1
- public\Get-MsecIntuneDevice.ps1
- public\Get-MsecIntuneScriptResult.ps1
- public\Get-MsecKeyVaultCertificate.ps1
- public\Get-MsecSecureScore.ps1
- public\Get-MsecSharePointSite.ps1
- public\Get-MsecSharePointSiteUser.ps1
- public\Get-MsecSharePointTenantSetting.ps1
- public\Get-MsecTeamsPolicy.ps1
- public\Invoke-MsecAzureVMScript.ps1
- public\New-MsecApp.ps1
- public\Search-MsecAzureResourceGraph.ps1
- public\Search-MsecLogAnalytics.ps1
- public\Select-MsecAzureContext.ps1
- scripts\Intune\Windows\entra-local-admins\README.md
- scripts\Intune\Windows\entra-local-admins\detect.ps1
- scripts\Intune\Windows\remove-local-admin\README.md
- scripts\Intune\Windows\remove-local-admin\detect.ps1
- scripts\Intune\Windows\remove-local-admin\remediate.ps1
- scripts\Intune\macOS\local-admins\README.md
- scripts\Intune\macOS\local-admins\custom-attribute.sh
- scripts\README.md
- scripts\VM\Linux\ntp-status.sh
- scripts\VM\Linux\os-info.sh
- scripts\VM\Linux\update-status.sh
- scripts\VM\Windows\eset-config.ps1
- scripts\VM\Windows\ntp-status.ps1
- scripts\VM\Windows\os-info.ps1
- scripts\VM\Windows\update-status.ps1
- tests\Connect-MsecGraphSdk.Tests.ps1
- tests\Convert-MsecEntraSid.Tests.ps1
- tests\ConvertTo-MsecAssignmentTarget.Tests.ps1
- tests\ConvertTo-MsecRolePrincipalRow.Tests.ps1
- tests\Export-MsecDefenderDeviceReport.Tests.ps1
- tests\Export-MsecEntraDisabledUserReport.Tests.ps1
- tests\Export-MsecEntraGroupMemberReport.Tests.ps1
- tests\Export-MsecPostureReport.Tests.ps1
- tests\Export-MsecVMNtpReport.Tests.ps1
- tests\Export-MsecVMUpdateReport.Tests.ps1
- tests\Get-MsecAccessToken.Tests.ps1
- tests\Get-MsecAzureCost.Tests.ps1
- tests\Get-MsecAzureDevOpsOrganizationPolicy.Tests.ps1
- tests\Get-MsecAzureDevOpsServiceConnection.Tests.ps1
- tests\Get-MsecAzureDevOpsUser.Tests.ps1
- tests\Get-MsecAzureRoleAssignment.Tests.ps1
- tests\Get-MsecAzureSecureScore.Tests.ps1
- tests\Get-MsecDefenderDevice.Tests.ps1
- tests\Get-MsecDefenderEmailStats.Tests.ps1
- tests\Get-MsecDefenderIncidentStats.Tests.ps1
- tests\Get-MsecEntraAppCredential.Tests.ps1
- tests\Get-MsecEntraConditionalAccessPolicy.Tests.ps1
- tests\Get-MsecEntraConditionalAccessSignInLog.Tests.ps1
- tests\Get-MsecEntraConditionalAccessStats.Tests.ps1
- tests\Get-MsecEntraDisabledUser.Tests.ps1
- tests\Get-MsecEntraGroupMember.Tests.ps1
- tests\Get-MsecEntraLicense.Tests.ps1
- tests\Get-MsecEntraMfaEvidence.Tests.ps1
- tests\Get-MsecEntraMfaRegistration.Tests.ps1
- tests\Get-MsecEntraMfaRegistrationStats.Tests.ps1
- tests\Get-MsecEntraRoleHolder.Tests.ps1
- tests\Get-MsecEntraTenantSecuritySetting.Tests.ps1
- tests\Get-MsecEnvironment.Tests.ps1
- tests\Get-MsecIntuneCompliancePolicy.Tests.ps1
- tests\Get-MsecIntuneConfigurationProfile.Tests.ps1
- tests\Get-MsecIntuneDevice.Tests.ps1
- tests\Get-MsecIntuneScriptResult.Tests.ps1
- tests\Get-MsecKeyVaultCertificate.Tests.ps1
- tests\Get-MsecSecureScore.Tests.ps1
- tests\Get-MsecSharePointTenantSetting.Tests.ps1
- tests\Get-MsecTeamsPolicy.Tests.ps1
- tests\IntuneRemediationScripts.Tests.ps1
- tests\Invoke-MsecAzureVMScript.Tests.ps1
- tests\Invoke-MsecGraphRequest.Tests.ps1
- tests\MsecCompletionCache.Tests.ps1
- tests\MsecFormatData.Tests.ps1
- tests\MsecManifest.Tests.ps1
- tests\MsecTenantProfile.Tests.ps1
- tests\MsecWorkloadConnect.Tests.ps1
- tests\New-MsecApp.Tests.ps1
- tests\New-MsecClientAssertion.Tests.ps1
- tests\Search-MsecAzureResourceGraph.Tests.ps1
- tests\Search-MsecLogAnalytics.Tests.ps1
- tests\Select-MsecAzureContext.Tests.ps1
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 0.3.0 (current version) | 18 | 9/9/2026 |
| 0.2.0 | 6 | 9/7/2026 |
| 0.1.1 | 16 | 8/20/2026 |
| 0.1.0 | 3 | 8/20/2026 |