Azure CLI task was failing with ERROR: An error occurred. Pip failed with status code 1.

Prudhvi Tavva 16 Reputation points
2023-03-17T04:52:27.7166667+00:00

Hi Team,

We are using azure CLI task in our pipeline to connect to our azure postgres flexi server to run scripts. Below is the task we have used.

FYI : day before yesterday also the task works fine, but from yesterday onwards I am getting below error.

WARNING: The command requires the extension rdbms-connect. It will be installed first.

ERROR: An error occurred. Pip failed with status code 1. Use --debug for more information.

##[error]Script failed with exit code: 1

Kindly help in fixing this issue.

            - task: AzureCLI@2
              displayName: 'Azure CLI '
              inputs:
                connectedServiceNameARM: MyServiceConnection
                scriptType: bash
                scriptLocation: inlineScript
                inlineScript: |
                  az login --service-principal -u $servicePrincipalId -p $servicePrincipalKey  --tenant $tenantId 
                  az config set extension.use_dynamic_install=yes_without_prompt 
                  az postgres flexible-server execute --name servername --admin-user "$(AZuser)" --admin-password "$(AZpassword)" --database-name "$(db)" --querytext 'CALL s."sp_CMappingCleanUp"()'
                scriptArguments:
                addSpnToEnvironment: true 
                workingDirectory: 'Testing'

Azure Database for PostgreSQL
{count} vote

5 answers

Sort by: Most helpful
  1. ShaktiSingh-MSFT 13,271 Reputation points Microsoft Employee
    2023-03-17T07:56:46.46+00:00

    Hi @Prudhvi Tavva ,

    Thanks for posting this question in Microsoft Q&A forum.

    As I understand, you are getting error in Azure CLI as below:

    WARNING: The command requires the extension rdbms-connect. It will be installed first.

    ERROR: An error occurred. Pip failed with status code 1. Use --debug for more information.

    Please make sure in the extensions list "rdbms-connect" is present.

    If present, try updating it using az extension add --name <extension-name>

    Let us know if the above steps helps and the results you obtained.

    Also, try to upgrade Azure CLI version as it older version might also cause error az upgrade

    Please reply with your inputs if not solved so that we can further assist you.

    Thank you.

    0 comments No comments

  2. audjur 0 Reputation points
    2023-03-17T12:44:54.8566667+00:00
    0 comments No comments

  3. ShaktiSingh-MSFT 13,271 Reputation points Microsoft Employee
    2023-03-20T05:51:34.81+00:00

    Hi @Prudhvi Tavva ,

    If the issue is still not solved, please try to Update setuptools to latest version:
    /opt/az/bin/python3 -Im pip install -U setuptools

    Let us know if this helped in your case. Thank you.

    0 comments No comments

  4. Nitish Karkar 0 Reputation points
    2023-04-13T12:22:17.71+00:00

    Tried all these steps but still not working


  5. ShaktiSingh-MSFT 13,271 Reputation points Microsoft Employee
    2023-04-25T06:07:42.7833333+00:00

    Hi Nitish Karkar •,

    We are sorry about the inconvenience you are facing.

    Could you please refer to the GitHub suggestions posted https://github.com/Azure/azure-cli/issues/25869 here.

    Also, please try to Update setuptools to latest version:

    /opt/az/bin/python3 -Im pip install -U setuptools

    Let us know if this helps. If not, please share at what step you are stuck so that we can assist you further. Thanks

    0 comments No comments