Azure-AD-Incident-Response-PowerShell-Module icon indicating copy to clipboard operation
Azure-AD-Incident-Response-PowerShell-Module copied to clipboard

Cannot get privilege roles - Cannot connect to AzureAD in VS Code

Open efd7887 opened this issue 2 years ago • 1 comments

This module does not work in VS Code because AzureAD module does not work

Get Azure Priv roles

Import-Module AzureADIncidentResponse
Connect-AzureADIR -TenantId ********-****-****-****-************ -UserUpn *****.*******@**********.onmicrosoft.com
Get-AzureADIRPrivilegedRoleAssignment -TenantId ********-****-****-****-************
Get-AzureADIRPrivilegedRoleAssignment -TenantId ********-****-****-****-************
WARNING: 11:27:56 AM - You must call Connect-AzureADIR to run this function
VERBOSE: 11:27:56 AM - Calling Connect AzureADIR
VERBOSE: 11:27:56 AM - Obtaining MS Graph access token...
VERBOSE: 11:27:56 AM - Checking token cache with -Prompt
VERBOSE: 11:28:06 AM - API Access Token obtained for: ********************@************.onmicrosoft.com (********-****-****-****-************)
VERBOSE: 11:28:06 AM - Obtaining Azure AD Graph access token...
VERBOSE: 11:28:06 AM - Checking token cache with -Prompt
VERBOSE: 11:28:06 AM - API Access Token obtained for: ********************@************.onmicrosoft.com (********-****-****-****-************)
VERBOSE: 11:28:06 AM - Connecting to ********-****-****-****-************ for Azure AD PowerShell module...
WARNING: 11:28:06 AM - Connection to ********-****-****-****-************ for Azure AD PowerShell module could not be established
VERBOSE: 11:28:06 AM - Calling Connect-MsolService cmdlet
VERBOSE: 11:28:06 AM - Connection to ********-****-****-****-************ for MSOnline PowerShell module could not be established
VERBOSE: 11:28:06 AM - Target tenant ID initial domain name - 
VERBOSE: 11:28:06 AM - Attempting to get directory roles
WARNING: 11:28:06 AM - No directory roles obtained
ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     2.0.2.182             AzureAD                             {Add-AzureADApplicationOwner, Add-AzureADDeviceRegisteredOwner, Add-AzureADDeviceRegisteredUser, Add-AzureADDirectoryRoleMember…}
Manifest   1.1.183.80            MSOnline                            {Add-MsolAdministrativeUnitMember, Add-MsolForeignGroupToRole, Add-MsolGroupMember, Add-MsolRoleMember…}
Script     2.2.5                 PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability…}

Version: 1.77.2 (user setup) Commit: e344f1f539a80912a0e9357cec841f36ce97a4e2 Date: 2023-04-06T10:08:05.978Z Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Windows_NT x64 10.0.19044 Sandboxed: No

efd7887 avatar Oct 16 '23 15:10 efd7887

Sort of fixed my own issue.

Connect-AzureAD: This module does not support PowerShell Core edition. Retry the operation with PowerShell Desktop edition (Windows PowerShell)

Use AzureADPreview module instead prior to connecting to IncidentResponse

Import-Module AzureADPreview -UseWindowsPowerShell

efd7887 avatar Oct 16 '23 15:10 efd7887