Share via

Authentication issue while invoking the Batch endpoint using Azure CLI V2

Nitish Kumar Rai 20 Reputation points
2023-12-05T06:30:49.4833333+00:00

Hi ,

I am trying to invoke the batch endpoint using the Github Action .
I am using Service principal with contributor access on resource group level to authorize the command. But on running the command, it failed in invoking the batch endpoint with below error :

DEBUG: azure.core.pipeline.policies._universal: Request URL: <end point url>
Request method: 'POST'
Request headers:
    'Content-Type': 'application/json'
    'Content-Length': '293'
    'Authorization': '***'
    'azureml-model-deployment': <deployment name>
    'User-Agent': 'azureml-cli-v2/2.22.0 azure-ai-ml/1.12.0 azsdk-python-core/1.26.0 Python/3.10.10 (Linux-4.18.0-477.27.1.el8_8.x86_64-x86_64-with-glibc2.31) '
Request body:
{"properties": {"inputData": {"UriFolder": {"uri": <inference boldstorage path>, "jobInputType": "UriFolder"}}}}

DEBUG: urllib3.connectionpool: <Batch end pint> "POST /jobs HTTP/1.1" 403 79
DEBUG: azure.core.pipeline.policies._universal: Response status: '403'
Response headers:
    'azureml-model-deployment': <deployment name>
    'content-length': '79'
    'content-type': 'text/plain'
    'date': 'Tue, 05 Dec 2023 05:25:55 GMT'
    'server': 'azureml-frontdoor'
    'x-request-id': 'de8a969a-0fba-4ce4-94d4-fce46e9736e5'
    'connection': 'close'
Response content:
Access to this resource is denied. Please check your ACL rules on the resource.
Traceback (most recent call last):
  File "/home/runner/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/_utils/_endpoint_utils.py", line 118, in validate_response
    r_json = response.json()
  File "/opt/az/lib/python3.10/site-packages/azure/core/rest/_http_response_impl.py", line 310, in json
    self._json = loads(self.text())
  File "/opt/az/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/opt/az/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/az/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During the post call to endpoint <Batch end point url>," the response status is 403, even if the service principal has all the necessary authorization to call this endpoint.

Please help me figuring out the issue.

Thanks in advance.

Azure Machine Learning

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.