Forum Discussion

EtienneFiset's avatar
EtienneFiset
Brass Contributor
Sep 26, 2024

How do I run a local Script using my local Azure Cli installation

Could be a stupid question, but didn't found anywhere to information. I'm trying to run a local script to Azure CLI on Mac and i didn't find the correct path or command for that.

 

Is it a way to do that ?

 

Local script on Desktop and run Az -

  • Hi Guys, I found the problem.. I can just connect Az login directly in the mac console. I was needed to Pwsh and Az login before running the script. Now it's working without issue
  • EtienneFiset 

     

    First, open your Terminal app on Mac. You can find it in Applications > Utilities
    Once you're in Terminal, next navigate to the directory where your script is saved
    cd ~/Desktop

     

    This takes you to your Desktop directory.
    Now, make sure your script is executable. To do this
    chmod +x your-script-name.sh

     

    Replace "your-script-name.sh" with the actual name of your script file.
    Finally, run the script!
    ./your-script-name.sh

     

    This executes the script in the current directory.
    If you wanna run the script using Azure CLI
    az ./your-script-name.sh

     

    This runs the script using Azure CLI

    • EtienneFiset's avatar
      EtienneFiset
      Brass Contributor

      balasubramanimWow, simple as *** i though i was needed to specify the path or upload the file in Azure. Thanks.

       

      Note: i have SA on the sub and RG in Azure and sign-in with az login before.

       

      I'm getting this error now :

       

       

      • balasubramanim's avatar
        balasubramanim
        Iron Contributor

        EtienneFiset 

         

        The error message './test.sh' is misspelled or not recognized by the system typically occurs if your terminal doesn't recognize the script or file location

         

        Verifying your current directory, ensuring the script is executable, and running it with the correct path, you can effectively troubleshoot and resolve the issue.

  • EtienneFiset's avatar
    EtienneFiset
    Brass Contributor
    Hi Guys, I found the problem.. I can just connect Az login directly in the mac console. I was needed to Pwsh and Az login before running the script. Now it's working without issue

Resources