I have an azure function project that cannot be deployed using github functions. The warnings and errors I get are these:
STEP: Build and Publish:
Run pushd './.'
pushd './.'
dotnet build --configuration Release
dotnet publish --configuration Release --output ./publish
popd
shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
env:
AZURE_FUNCTIONAPP_NAME: function-core-api
AZURE_FUNCTIONAPP_PACKAGE_PATH: .
DOTNET_VERSION: 8.0.x
CONFIGURATION: Release
DOTNET_CORE_VERSION: 8.0.x
WORKING_DIRECTORY: .
DOTNET_ROOT: C:\Program Files\dotnet
Determining projects to restore...
All projects are up-to-date for restore.
Warning: C:\a\functions\functions\Services\VideoService.cs(379,29): warning CS8602: Dereference of a possibly null reference. [C:\a\functions\functions\functions.csproj]
Determining projects to restore...
Restored C:\a\functions\functions\obj\Release\net8.0\WorkerExtensions\WorkerExtensions.csproj (in 7.75 sec).
WorkerExtensions -> C:\a\functions\functions\obj\Release\net8.0\WorkerExtensions\buildout\Microsoft.Azure.Functions.Worker.Extensions.dll
functions -> C:\a\functions\functions\bin\Release\net8.0\functions.dll
Build succeeded.
Warning: C:\a\functions\functions\Services\VideoService.cs(379,29): warning CS8602: Dereference of a possibly null reference. [C:\a\functions\functions\functions.csproj]
1 Warning(s)
0 Error(s)
Time Elapsed 00:01:10.18
Determining projects to restore...
All projects are up-to-date for restore.
Warning: C:\Program Files\dotnet\sdk\9.0.300\Current\SolutionFile\ImportAfter\Microsoft.NET.Sdk.Solution.targets(36,5): warning NETSDK1194: The "--output" option isn't supported when building a solution. Specifying a solution-level output path results in all projects copying outputs to the same directory, which can lead to inconsistent builds. [C:\a\functions\functions\functions.sln]
Determining projects to restore...
All projects are up-to-date for restore.
WorkerExtensions -> C:\a\functions\functions\obj\Release\net8.0\WorkerExtensions\buildout\Microsoft.Azure.Functions.Worker.Extensions.dll
functions -> C:\a\functions\functions\bin\Release\net8.0\functions.dll
functions -> C:\a\functions\functions\publish\
STEP: Deploy to Azure Functions
Run Azure/functions-action@v1
with:
app-name: core-api
package: ./publish
publish-profile: ***
respect-funcignore: true
scm-do-build-during-deployment: false
enable-oryx-build: false
respect-pom-xml: false
remote-build: false
env:
AZURE_FUNCTIONAPP_NAME: core-api
AZURE_FUNCTIONAPP_PACKAGE_PATH: .
DOTNET_VERSION: 8.0.x
CONFIGURATION: Release
DOTNET_CORE_VERSION: 8.0.x
WORKING_DIRECTORY: .
DOTNET_ROOT: C:\Program Files\dotnet
Successfully parsed SCM credential from publish-profile format.
Using SCM credential for authentication, GitHub Action will not perform resource validation.
Error: Execution Exception (state: ValidateAzureResource) (step: Invocation)
Error: When request Azure resource at ValidateAzureResource, Get Function App Settings : Failed to acquire app settings from https://<scmsite>/api/settings with publish-profile
Error: Failed to fetch Kudu App Settings.
Unauthorized (CODE: 401)
Error: Error: Failed to fetch Kudu App Settings.
Unauthorized (CODE: 401)
at Kudu.<anonymous> (C:\a_actions\Azure\functions-action\v1\lib\appservice-rest\Kudu\azure-app-kudu-service.js:72:23)
at Generator.next (<anonymous>)
at fulfilled (C:\a_actions\Azure\functions-action\v1\lib\appservice-rest\Kudu\azure-app-kudu-service.js:5:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Error: Deployment Failed!
At some point I realized that when I copy and pasted the publish profile, all credentials are REDACTED, so the secret has no credentials but the word "REDACTED". Is that normal or should I complete the file manually.
this is what I get
<publishData><publishProfile profileName="core-api - Web Deploy" publishMethod="MSDeploy" publishUrl="core-api.scm.azurewebsites.net:443" msdeploySite="core-api" userName="REDACTED" userPWD="REDACTED" destinationAppUrl="https://core-api.azurewebsites.net" SQLServerDBConnectionString="REDACTED" mySQLDBConnectionString="" hostingProviderForumLink="" controlPanelLink="https://portal.azure.com" webSystem="WebSites"><databases /></publishProfile><publishProfile profileName="core-api - FTP" publishMethod="FTP" publishUrl="ftps://waws-prod-bn1-285.ftp.azurewebsites.windows.net/site/wwwroot" ftpPassiveMode="True" userName="REDACTED" userPWD="REDACTED" destinationAppUrl="https://core-api.azurewebsites.net" SQLServerDBConnectionString="REDACTED" mySQLDBConnectionString="" hostingProviderForumLink="" controlPanelLink="https://portal.azure.com" webSystem="WebSites"><databases /></publishProfile><publishProfile profileName="core-api - Zip Deploy" publishMethod="ZipDeploy" publishUrl="core-api.scm.azurewebsites.net:443" userName="REDACTED" userPWD="REDACTED" destinationAppUrl="https://core-api.azurewebsites.net" SQLServerDBConnectionString="REDACTED" mySQLDBConnectionString="" hostingProviderForumLink="" controlPanelLink="https://portal.azure.com" webSystem="WebSites"><databases /></publishProfile></publishData>
As I mentioned in comment
When Function Is deployed using Publish profile make sure `SCM Basic Auth` in settings is enabled
Function App-->Configuration-->General settings --> SCM basic Auth--> On