microsoft / Microsoft365DSC

Manages, configures, extracts and monitors Microsoft 365 tenant configurations
https://aka.ms/M365DSC
MIT License
1.64k stars 505 forks source link

Can't connect with Azure Runbook and Managed Identity #4662

Open Mika5283 opened 6 months ago

Mika5283 commented 6 months ago

Description of the issue

Hello, When I try to run my Runbook, I always have this error : "The term 'Add-ConfigurationDataEntry' is not recognized.

I use this command : Export-M365DSCConfiguration -ManagedIdentity -Components @("AADUser") -TenantId "mytenant.onmicrosoft.com"

I have these modules installed :

I tried in 7.2 and 5.1 environment and the result is the same ? I also tried to update the dependencies and removed the old one.

Thanks

Microsoft 365 DSC Version

1.24.424.1

Which workloads are affected

Azure Active Directory (Entra ID)

The DSC configuration

No response

Verbose logs showing the problem

No response

Environment Information + PowerShell Version

No response

Mika5283 commented 6 months ago

Is anyone has an idea please ?

Mika5283 commented 6 months ago

Seems that the problem was with reversedsc module. I update it and I have a new error yet :

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80) (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed torespond.))`

My code is only that :

Connect-AzAccount -Identity
Export-M365DSCConfiguration -ManagedIdentity -Components @("ExoAcceptedDomain") -TenantId "XXX.onmicrosoft.com" -Verbose -Debug

Do you have an idea with this problem ?

andikrueger commented 5 months ago

M365DSC and its connection handling module MSCloudLoginAssistant do not check for previously established connections. Your first line of code would be ignored and the connection would be established in line 2.

It looks like there is an issue within MsCloudLoginAssistant on how the cmdlet is called:

https://github.com/microsoft/MSCloudLoginAssistant/blob/917faed08aec286d4ac3b793cf2275b40ec078d5/Modules/MSCloudLoginAssistant/Workloads/ExchangeOnline.psm1#L190

There is still a bit of App based authentication left.

risetostar commented 2 weeks ago

Hi All, In addition to the above, we also encountered the following issue when trying to run the following command and getting below error

Export-M365DSCConfiguration -Components @("O365OrgSettings") -Credential $Credential

Export-M365DSCConfiguration -Components @("O365OrgSettings") -Credential $Credential Exporting Microsoft 365 configuration for Components: O365OrgSettings

Authentication methods specified:

Partial Export file was saved at: C:\Users\AppData\Local\Temp\85405883-c40b-40da-ab15-9696bdb6caef.partial.ps1 Exception: The term 'Add-ConfigurationDataEntry' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Any help or suggestion would be highly appreciated. Thanks