Azure / Azure/azure-cli

az login inside containerapp code no longer working.

Open
#30,832 5 comments 1 reaction 1 assignee Claimed by @jiasli View on GitHub
Account act-identity-squad Auto-Assign bug Possible-Solution Service Attention Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

Before the CLI change to 'az login --identity' I 'az login --identity --username' to login and the run 'az aks get-credentials'

### Related command

```
string command = $"-c \"az login --identity --username {manageId} && az aks get-credentials --resource-group {buildInfo.resourceGroupName} --name {buildInfo.clusterName} --overwrite-existing\""; // Command to log in to Azure

// Create a process start info
ProcessStartInfo loginInfo = new ProcessStartInfo
{
FileName = "bash",
Arguments = command,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false
};

// Create and start the process
using (Process process = new Process())
{
process.StartInfo = loginInfo;
process.Start();


string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();

// Wait for the process to exit
process.WaitForExit();

// Check exit code
int exitCode = process.ExitCode;
if (exitCode == 0)
{
// Command executed successfully
Console.WriteLine("Command executed successfully");
Console.WriteLine($"Output: {output}");
}
else
{
// Command failed
Console.WriteLine($"Command failed with exit code {exitCode}");
Console.WriteLine($"Error output: {error}");
}
}

```

### Errors

ERROR: Failed to connect to MSI. Please make sure MSI is configured correctly.

Error occurs even after updating the command to use '--client-id'

### Issue script & Debug output

N/A

### Expected behavior

Expected to be able to login to azure cli

### Environment Summary

Whatever version of CLI is running inside Azure Container App

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.