microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.47k stars 2.6k forks source link

Task removes Function App Host Key #17658

Closed am8448 closed 1 year ago

am8448 commented 1 year ago

When I run this task on a new deployed function app, it removes any custom Function App host key that I've defined. The host key no longer exists. If I was to then create a new host key, rerun the task, the host key remains. I can't see any option that may affect host key on the task. Why is being removed? Is this default behaviour? If so, what purpose does it serve? Or is this a bug?

Note

Issues in this repo are for tracking bugs, feature requests and questions for the tasks in this repo

For a list:
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

If you have an issue or request for the Azure Pipelines service, use developer community instead:

https://developercommunity.visualstudio.com/spaces/21/index.html )

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: here

Enter Task Name: here

list here (V# not needed):
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

Environment

Issue Description

[Include task name(s), screenshots and any other relevant details]

Task logs

[Enable debug logging and please provide the zip file containing all the logs for a speedy resolution]

Troubleshooting

Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting

Error logs

[Insert error from the logs here for a quick overview]

DmitriiBobreshev commented 1 year ago

Hi @am8448, thanks for the feedback, could you please specify the task name, and version? Also could you please share the task definition from the pipeline?

am8448 commented 1 year ago

Hi @DmitriiBobreshev, is it ok to provide the yaml task:

- task: AzureFunctionApp@1
  displayName: Deploy App
  enabled: true
  inputs:
    azureSubscription: ${{variables.serviceConnectionName}}
    appType: 'functionApp'
    appName: $(functionAppName)
    package: $(Pipeline.Workspace)/$(appArtifact)/AetherFuncApp.zip
    appSettings: -AADRole_London "$(AADRole_London)" 
      -TimescapeDatabaseDataKeepDays "$(TimescapeDatabaseDataKeepDays)"

- task: AzureCLI@2
  displayName: 'Confirm Function App Host Key'
  enabled: true
  inputs:
    azureSubscription: '${{variables.serviceConnectionName}}'
    scriptType: pscore
    scriptLocation: 'InlineScript'
    inlineScript: |
      $functionAppKeyName = "functionAppKey"
      $functionAppKey = az functionapp keys list -g $(resourceGroup) -n $(functionAppName) --query "functionKeys.$functionAppKeyName" --output tsv
      If($functionAppKey){Write-Host "Found Function App Key: $functionAppKeyName"}
      Else{az functionapp keys set -g $(resourceGroup) -n $(functionAppName) --key-type functionKeys --key-name "$functionAppKeyName" --key-value "$(functionAppKey)"}
DmitriiBobreshev commented 1 year ago

Thank's a lot! Unfortunately, our team don't own this task, but maybe @rvairavelu could help with it.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days