Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Entry point was not found" when using KeyVault modules #2681

Closed
MattHarrisUltima opened this issue Sep 15, 2023 · 16 comments
Closed

"Entry point was not found" when using KeyVault modules #2681

MattHarrisUltima opened this issue Sep 15, 2023 · 16 comments
Labels
bug Something isn't working completed The issue has been completed but is not yet released. PowerShell Universal Issue relates to PowerShell Universal.

Comments

@MattHarrisUltima
Copy link

Version

4.1.0

Severity

High

Steps to Reproduce

Following testing of a new environment and upgrade of a container image on an existing environment, Azure connectivity does not appear to be working as expected.

The container image in question is: ironmansoftware/universal:4.1.0-modules

In a new environment, PowerShell Universal appears to be unable to connect to an Azure Tenant via Service Principal. claiming it can not find an application ID in the given tenant.

[warning] The provided service principal secret or certifcate password will be included in the 'keystore.cache' file found in the user profile ( /root/.Azure ). Please ensure that this directory has appropriate protections. 
[error] Entry point was not found.
Could not find tenant id for provided tenant domain 'xxxxxxxx-aae9-44fe-bdc4-53f76xxxxxd0'. Please ensure that the provided service principal 'xxxxxxx-4d45-4a37-be96-dfea4xxxxx71' is found in the provided tenant domain. 

In an upgraded environment, Get-AZContext returns the current subscription in a tenant however Disconnect-AZAccount returns the following error:

[ERROR] Method not found: 'Microsoft.Identity.Client.PublicClientApplicationBuilder Microsoft.Identity.Client.Broker.BrokerExtension.WithBrokerPreview(Microsoft.Identity.Client.PublicClientApplicationBuilder, Boolean)'.

A Get-AZKeyvault returns the following error:

[ERROR] Your Azure credentials have not been set up or have expired, please run Connect-AzAccount to set up your Azure credentials.
Entry point was not found.

I can see there have been some version changes in the modules provided this may be the problem
2023-09-15 13_54_24-PowerShell Universal — Mozilla Firefox
:

Expected behavior

Commands like `Connect-AZAccount`, `Disconnect-AZAccount`, and `Get-AZKeyvault` work as expected.

Actual behavior

`Disconnect-AZAccount` returns the following error:

[ERROR] Method not found: 'Microsoft.Identity.Client.PublicClientApplicationBuilder Microsoft.Identity.Client.Broker.BrokerExtension.WithBrokerPreview(Microsoft.Identity.Client.PublicClientApplicationBuilder, Boolean)'.

A Get-AZKeyvault returns the following error:

[ERROR] Your Azure credentials have not been set up or have expired, please run Connect-AzAccount to set up your Azure credentials.
Entry point was not found.

Reverting to 4.0.12-modules and re-running my keyvault setup commands appears to return functionality.



### Additional Environment data

_No response_

### Visuals

_No response_
@MattHarrisUltima MattHarrisUltima added bug Something isn't working PowerShell Universal Issue relates to PowerShell Universal. requires triage Issue has not yet been verified by the development team. labels Sep 15, 2023
@adamdriscoll adamdriscoll added completed The issue has been completed but is not yet released. and removed requires triage Issue has not yet been verified by the development team. labels Sep 18, 2023
@MattHarrisUltima
Copy link
Author

Hi @adamdriscoll,

Thank you for making the change to static versions, however it appears the versions have been frozen on the faulty versions.

Are you able to modify this on the next release?

@adamdriscoll
Copy link
Member

adamdriscoll commented Sep 20, 2023

Hmmm. Let me double check this. I thought we pinned to the older versions.

UPDATE: It looks like both versions got in some how...

image

@adamdriscoll
Copy link
Member

I found the root cause. This will be in tonight's module-preview container and next week's 4.1.2 release.

@MattHarrisUltima
Copy link
Author

MattHarrisUltima commented Sep 20, 2023 via email

@MattHarrisUltima
Copy link
Author

Hi @adamdriscoll,

It looks like we are still getting some errors.

After testing the preview image, ironmansoftware/universal:4.1.2-preview-modules I am still receiving the same error In 4.1.x using the same versions.

I transferred the

Connecting to Azure appears to be the problem.

I have pulled 4.1.1-ubuntu-20.04 without the modules and moved Az.Accounts into the /root modules' folder, and I am receiving exactly the same error:

[warning] The provided service principal secret or certifcate password will be included in the 'keystore.cache' file found in the user profile ( /root/.Azure ). Please ensure that this directory has appropriate protections. 
[error] Entry point was not found.
Could not find tenant id for provided tenant domain '########-####-####-####-############'. Please ensure that the provided service principal '########-####-####-####-############' is found in the provided tenant domain. 

I pulled a copy of Az.Accounts version 2.10.14 from a backup and it appears to work. Im wondering if the Az.Accounts module bundled in the home directory has been corrupted?

@adamdriscoll adamdriscoll removed the completed The issue has been completed but is not yet released. label Sep 22, 2023
@adamdriscoll adamdriscoll reopened this Sep 22, 2023
@adamdriscoll
Copy link
Member

Very weird. We are using Save-Module to download that module before building the container so I don't know why it would be corrupt.

@MattHarrisUltima
Copy link
Author

I agree, this is very weird.

Had anything else been added in 4.1.x which could disrupt module loading? I saw PowerShell 7.3.7 was included, I was wondering if anything else relating to code execution within an environment could have changed?

@MattHarrisUltima
Copy link
Author

Hi @adamdriscoll,

I have been thinking this over. Is there a command I can use to rescan the /home/Universal/Modules/ manually?

This would allow me to monitor logs and potentially do some testing.

@MattHarrisUltima
Copy link
Author

Hi @adamdriscoll

Please advise if there is anything you need from me on this issue.

Additionally, after today I am on annual leave until the 9th October and will be unable to reply until my return.

@adamdriscoll
Copy link
Member

@MattHarrisUltima - I will be reviewing this tomorrow and will let you know if I need anything else. Hopefully this is resolved when you return. :)

@adamdriscoll
Copy link
Member

Success!

image

After much code spelunking, I was able to determine the root cause was actually the upgrade Microsoft.Data.SqlClient. It included a reference to Azure.Identity 1.7.0. The Az cmdlets actually use a newer version of that package. Once I upgraded that, it works great.

@adamdriscoll adamdriscoll added completed The issue has been completed but is not yet released. and removed completed The issue has been completed but is not yet released. labels Oct 1, 2023
@adamdriscoll adamdriscoll removed this from the PowerShell Universal 4.1.3 milestone Oct 2, 2023
@adamdriscoll
Copy link
Member

While this fixed Azure Accounts integration, it broke a lot of other things. I need to push this to 4.2. We are rolling this back and releasing 4.14.

@adamdriscoll adamdriscoll reopened this Oct 2, 2023
@adamdriscoll adamdriscoll added this to the PowerShell Universal 4.2 milestone Oct 2, 2023
@MattHarrisUltima
Copy link
Author

Hi @adamdriscoll,

Thanks for the update. I will wait for 4.2.

@adamdriscoll adamdriscoll added the completed The issue has been completed but is not yet released. label Oct 9, 2023
@adamdriscoll
Copy link
Member

@MattHarrisUltima - This change will be included in tonight's nightly build and preview containers.

@MattHarrisUltima
Copy link
Author

Thanks for the preview image @adamdriscoll

That loads up without error on my end.

Please feel free to reach out if you would like any images tested.

@adamdriscoll
Copy link
Member

This issue has been mentioned on Ironman Software Forums. There might be relevant details there:

https://forums.ironmansoftware.com/t/can-no-longer-connect-to-azure-with-connect-azaccount/9908/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completed The issue has been completed but is not yet released. PowerShell Universal Issue relates to PowerShell Universal.
Projects
None yet
Development

No branches or pull requests

2 participants