Skip to content

Commit

Permalink
Fix bug in configure-continuous-deployments CLI command when az CLI t…
Browse files Browse the repository at this point in the history
…hrows an exception
  • Loading branch information
tjementum committed Jan 26, 2025
1 parent 3b6e9ff commit 94a34a1
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions developer-cli/Commands/ConfigureContinuousDeploymentsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -619,22 +619,24 @@ void CreateFederatedCredential(string appRegistrationId, string displayName, str
{
var parameters = JsonSerializer.Serialize(new
{
name = displayName,
issuer = "https://token.actions.githubusercontent.com",
subject = $"""repo:{Config.GithubInfo!.Path}:{refRefsHeadsMain}""",
audiences = new[] { "api://AzureADTokenExchange" }
}
name = displayName,
issuer = "https://token.actions.githubusercontent.com",
subject = $"""repo:{Config.GithubInfo!.Path}:{refRefsHeadsMain}""",
audiences = new[] { "api://AzureADTokenExchange" }
}
);

ProcessHelper.StartProcess(new ProcessStartInfo
{
FileName = Configuration.IsWindows ? "cmd.exe" : "az",
Arguments =
$"{(Configuration.IsWindows ? "/C az" : string.Empty)} ad app federated-credential create --id {appRegistrationId} --parameters @-",
RedirectStandardInput = true,
RedirectStandardOutput = !Configuration.VerboseLogging,
RedirectStandardError = !Configuration.VerboseLogging
}, parameters
FileName = Configuration.IsWindows ? "cmd.exe" : "az",
Arguments =
$"{(Configuration.IsWindows ? "/C az" : string.Empty)} ad app federated-credential create --id {appRegistrationId} --parameters @-",
RedirectStandardInput = true,
RedirectStandardOutput = !Configuration.VerboseLogging,
RedirectStandardError = !Configuration.VerboseLogging
},
parameters,
exitOnError: false
);
}
}
Expand Down Expand Up @@ -906,7 +908,7 @@ private string RunAzureCliCommand(string arguments, bool redirectOutput = true)
{
var azureCliCommand = Configuration.IsWindows ? "cmd.exe /C az" : "az";

return ProcessHelper.StartProcess($"{azureCliCommand} {arguments}", redirectOutput: redirectOutput);
return ProcessHelper.StartProcess($"{azureCliCommand} {arguments}", redirectOutput: redirectOutput, exitOnError: false);
}

private static Dictionary<string, string> GetAzureLocations()
Expand Down

0 comments on commit 94a34a1

Please sign in to comment.