Share via

Azure function returns 403 error.

Ayush Shrivastava 120 Reputation points
2024-09-04T21:21:33.5466667+00:00

I am calling my azure function from ASD and the function returns 403.

I have configured it to send 401 in case of unauthorised requests.

I want to use managed identity to trigger the function.

Here is my function code.

package
import
import
import
import
import
import
import
import
import
/**
 * Azure Functions with HTTP Trigger.
 */
public
 /**
 * This function listens at endpoint "/api/HttpExample". Two ways to invoke it using "curl" command in bash:
 * 1. curl -d "HTTP Body" {your host}/api/HttpExample
 * 2. curl "{your host}/api/HttpExample?name=HTTP%20Query"
 */
 @
public
 @
name
methods
authLevel
HttpRequestMessage
final
context
// Parse query parameter
final
final
if
return
 } 
String
 {
 "name" : "response"
 }
 """
context
return
 }
 }
}

Here is my query -

DECLARE

EXEC
@url
@method
@credential
@response
SELECT
@response

I think I need to give my Sql servers managed identity some permissions but I am not able to figure what permission it needs.

Azure SQL Database
Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.


2 answers

Sort by: Most helpful
  1. Ayush Shrivastava 120 Reputation points
    2024-09-05T16:30:36.7+00:00

    This is still not working. Can we do this over a quick call?

    Was this answer helpful?

    0 comments No comments

  2. Nandan Hegde 36,886 Reputation points MVP Volunteer Moderator
    2024-09-05T03:35:13.74+00:00

    For bare minimal testing, you can provide the Azure SQL server contributor role at the Azure function via RBAC and test out your execution.

    Note : This is some higher privelege

    You can follow the below link to create a custom role for least min privilege if need be :

    https://stackoverflow.com/questions/63610514/which-permission-allows-triggering-of-an-azure-function

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.