欧博allbetcannot query azure search ai endpoint
I am using the below to authentication into azure search:
cred = DefaultAzureCredential() token = cred.get_token(api) params = {'api-version': os.environ['AZURE_SEARCH_API_VERSION']} headers = {'Authorization': f'Bearer {token}','Content-Type': 'application/json'} search_payload = { "search": QUESTION, # Text query "select": "id, title, name, location, chunk", "queryType": "semantic", "vectorQueries": [{"text": QUESTION, "fields": "chunkVector", "kind": "text", "k": k}], # Vector query "semanticConfiguration": "my-semantic-config", "captions": "extractive", "answers": "extractive", "count":"true", "top": k } r = requests.post(os.environ['AZURE_SEARCH_ENDPOINT'] + "/indexes/" + index + "/docs/search", data=json.dumps(search_payload), headers=headers, params=params)however i get a 401 error code when i print status code of r.
note: i have permissions of "Search Index Data Reader" and the app has an identity.
what else could be causing this issue?
2025-08-07 09:38 点击量:6