You should create a Service Principal in Azure Active Directory (AAD) within the tenant where the Azure Function is hosted. This Service Principal acts as an identity for applications, allowing secure access without exposing user credentials.
Assign the necessary roles and permissions to this Service Principal. For deploying Azure Functions, it might need Contributor or similar roles on the Function App resource.
In Azure DevOps, create a new Service Connection using the Service Principal. This connects your Azure DevOps project to your Azure subscription and allows Azure DevOps to deploy resources to Azure.
Modify your pipeline YAML or release definition in Azure DevOps to use the newly created Service Connection. This ensures that the pipeline has the correct permissions to deploy the Azure Function.
Here is an old thread that may help you : https://learn.microsoft.com/en-us/answers/questions/1043418/https-403-error-from-azure-function