Closed jirikopecky closed 2 days ago
@jirikopecky Thanks for the detailed issue description and logs and I apologize for this issue that you're running into. Looking into hashicorp/go-azure-helpers
and the code snippet you provided, it appears that in order for MSI to be used as an authentication method, MSI_ENDPOINT
and MSI_SECRET
must be unset/empty as they specifically mention:
if the Endpoint and Sender are present this is App Service/Function Apps which we intentionally don't support at this time
.
Having these 2 env variables set would result in the MSI authentication mode to be marked as not applicable, and skipped as an auth method.
Could you try to unset these 2 variables in your container and see if it resolves your issue?
These environment variables are set automatically by Azure Container Apps runtime and as such are out of our control, so we cannot unset them.
Has there been any progress on this? Unsetting these variables also doesn't work, because then the library can't find the correct MSI endpoint.
I also tried creating workaround using az login --identity
, but that is also blocked, because CLI login can only be used by User, not service principal.
Is there any progress on this please? We are currently facing this issue when trying to run pulumi code within an Azure container app which authenticates to Azure using managed identity (MSI).
+1
The new v2.70 release should fix this as it introduces a new authentication backend with support for various variants of MSI such as Service Fabric, App Service, Arc, Azure ML, and Cloud Shell. You can see all the details in the package source.
The new authentication backend is behind a feature toggle for the time being. Set environment variable PULUMI_ENABLE_AZCORE_BACKEND
to "true"
to use it. Please report back any issues you may be encountering.
As I don't have a working repro for this issue, I couldn't verify that the new backend fixes it, but I think it will.
I'll optimistically close this issue but feel free to re-open if you still face issues.
What happened?
We have an application that manages Azure resources using Pulumi Automation API. This application is written in .NET and deployed as Azure Container App with Pulumi CLI installed in the container. We wanted to migrate away from using Service Principal to use MSI for authentication agains Azure. This was attempted by setting
ARM_USE_MSI
totrue
in the container environment (and of course creating user-assigned MSI with relevant permissions assigned and associating it with the container app).While attempting to run
Up
on the stack we received following error:Expected Behavior
Pulumi uses configured managed identity to manage Azure resources
Steps to reproduce
azure-native
(we used version 1.100.1)ARM_USE_MSI
environment variable set totrue
Output of
pulumi about
There is no project since the app uses Automation API to create workspaces on-the-fly.
Additional context
I was able to capture following log from the provider:
Looking at
hashicorp/go-azure-helpers
source I found following snippet. Mentioned environment variables are set within the Container App environment.Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).