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

[Bug]: Deploy to Environment #1136

Closed
pzentner opened this issue Jul 10, 2024 · 4 comments · Fixed by #1150
Closed

[Bug]: Deploy to Environment #1136

pzentner opened this issue Jul 10, 2024 · 4 comments · Fixed by #1150
Labels
bug Something isn't working Fix Ready Fix Ready In Preview Currently available in AL-Go for GitHub preview

Comments

@pzentner
Copy link
Contributor

Using: AL-Go-Preview (current)

We have environments configured in GitHub (UAT, for instance) and have an environment secret "AUTHCONTEXT" created with the proper Json in there. However, when we run the CI/CD pipeline, it throws the following errors when trying to deploy the apps to the environment.

Did anything change in the way this is working or has to be defined? It used to work (not sure exactly when last).

Waiting for other process executing ReadSecrets
Other process completed ReadSecrets
Masking value for ClientSecret
Trying to get the secret (UAT-AuthContext) from the github environment.
Trying to get the secret (UAT-AuthContext) from Key Vault (*****).
Module Az.KeyVault is available in version 6.0.1
Importing module Az.KeyVault (minimum version 5.2.0)
Connecting to Azure using clientId and clientSecret.
Selecting subscription ***
Successfully connected to Azure
Trying to get the secret (UAT_AuthContext) from the github environment.
Trying to get the secret (UAT_AuthContext) from Key Vault (*****).
Error: Unexpected error when running action. Error Message: Error trying to get secrets from Azure Key Vault. Error was Operation returned an invalid status code 'BadRequest' Code: BadParameter Message: The request URI contains an invalid name: UAT_AuthContext, StackTrace: at GetKeyVaultSecret, C:\1\_work\_actions\microsoft\AL-Go\5eeeec54ab7e6a9d97701effe[42](https://github.com/***/***/actions/runs/9858901855/job/27290709587#step:6:44)0ef74bda08c67\Actions\ReadSecrets\ReadSecretsHelper.psm1: line 150 <- at GetSecret, C:\1\_work\_actions\microsoft\AL-Go\5eeeec54ab7e6a9d97701effe420ef74bda08c67\Actions\ReadSecrets\ReadSecretsHelper.psm1: line 186 <- at <ScriptBlock>, C:\1\_work\_actions\microsoft\AL-Go\5eeeec54ab7e6a9d97701effe420ef74bda08c67\Actions\ReadSecrets\ReadSecrets.ps1: line 88 <- at <ScriptBlock>, C:\1\_work\_temp\ed2defd3-3cb5-4bde-bb87-26a618228d5e.ps1: line 4 <- at <ScriptBlock>, <No file>: line 1
Error: Process completed with exit code 1.
@freddydk
Copy link
Collaborator

freddydk commented Jul 11, 2024

Looks like a bug.
We did some changes to this area, which shouldn't have affected the functionality though.
Do you have an AZURE_CREDENTIALS defined with access to a keyvault?
Are you using the keyvault for secrets?

If you change to use microsoft/AL-Go-PTE@main -. I assume it works then?

@freddydk freddydk added the bug Something isn't working label Jul 11, 2024
@pzentner
Copy link
Contributor Author

I changed it to use microsoft/AL-Go-PTE@main and yes, it is working. I also have the AZURE_CREDENTIALS defined with access to a keyvault and am using the keyvault for secrets, but not for the environment secrets.

@freddydk freddydk changed the title Question: Deploy to Environment [Bug] Deploy to Environment Jul 19, 2024
@freddydk freddydk changed the title [Bug] Deploy to Environment [Bug]: Deploy to Environment Jul 19, 2024
freddydk added a commit to freddydk/AL-Go that referenced this issue Jul 20, 2024
@freddydk
Copy link
Collaborator

freddydk commented Jul 20, 2024

The reason for this issue is that this powershell command:

Get-AzKeyVaultSecret -VaultName "BuildVariables" -Name 'UAT-AUTHCONTEXT'

will return the secret if it exists or null if it doesn't, whereas this command

Get-AzKeyVaultSecret -VaultName "BuildVariables" -Name 'UAT_AUTHCONTEXT'

Will throw due to an illegal secret name.

GitHub secrets allows '_', but not '-'
Azure DevOps keyvault allows '-', but not '_'

Therefore, we look for both, but it obviously shouldn't throw.

@freddydk
Copy link
Collaborator

Shipped in preview

@freddydk freddydk added Fix Ready Fix Ready In Preview Currently available in AL-Go for GitHub preview labels Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fix Ready Fix Ready In Preview Currently available in AL-Go for GitHub preview
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants