Hello, I have question regarding calling storage API from the remote backend such as Azure Function.
Currently, I have set up scheduled trigger that triggers the endpoint every hour. Here is corresponding manifest code snippet:
scheduledTrigger:
- key: storageSyncTrigger
endpoint: remote-database
interval: hour
endpoint:
- key: remote-database
remote: remote-dataBase-setup
route:
path: /api/storageSync
auth:
appSystemToken:
enabled: true
The scheduled trigger calls the remote backend properly.
The problem is that I have went through a documentation regarding storage API, but as a person who just started working with HTTP related work, it is very confusing to me how to start.
I can see a part in the documentation talking about authentication but I do not how to provide a bearer token.
I have seen in other documentations, talking that request header contains a header that has a token, but it seems like it does not, or I am doing something wrong.
const { app } = require('@azure/functions');
app.http('storageSync', {
methods: ['GET', 'POST'],
authLevel: 'anonymous',
handler: async (request, context) => {
context.log("Request: ", request);
context.log("Context: ", context);
This code is part of the Azure Function code, and it simply logs request and the context.
The result is as follows:
Request: HttpRequest { query: URLSearchParams {}, params: {} }
Context: InvocationContext { invocationId: '89df521b-bbf8-4968-bdf6-eeb66e68c646', functionName: 'storageSync', extraInputs: InvocationContextExtraInputs {}, extraOutputs: InvocationContextExtraOutputs {}, retryContext: undefined, traceContext: { traceParent: '00-c3c798e8c44a186a99db3536fd711a16-85ce07e3235aa754-00', traceState: '', attributes: {} }, triggerMetadata: undefined, options: { trigger: { methods: [Array], authLevel: 'anonymous', type: 'httpTrigger', name: 'httpTrigger624a61988c', direction: 'in' }, return: { type: 'http', name: '$return', direction: 'out' }, extraInputs: [], extraOutputs: [] } }
To my understanding, token for authorization should be here somewhere, but I am probably wrong.
Any help on how to further progress this would be appreciated.