Deploy Azure infrastructure by using JSON ARM templates

Sereysothea So 80 Reputation points
2024-01-23T00:57:41.98+00:00

Exercise - Create and deploy an Azure Resource Manager template I'm running into issue on this module. I followed the instructions and every steps but once I got to the command below, [Error 2] No such file or directory: 'azuredeploy.json'. (Attached image). Deploy the template to Azure Run the following commands to deploy the ARM template to Azure. The ARM template doesn't have any resources yet, so you won't see any resources created. You should get a successful deployment. Azure CLICopy `templateFile="azuredeploy.json" today=$(date +"%d-%b-%Y") DeploymentName="blanktemplate-"$today

az deployment group create
--name $DeploymentName
--template-file $templateFile` I verified sandbox is activated on Azure portal and same account signed on VS Code. Error 2.png Any suggestions or advices would be appreciated. Thank you.

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
2,034 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rakesh Gurram 11,815 Reputation points Microsoft Vendor
    2024-01-25T05:53:40.0566667+00:00

    Hi Sereysothea So,

    When you are using Git Bash and Azure CLI, the "present directory" or current working directory is where you should save your 'azuredeploy.json' file. It is the directory in which you are currently located when running commands in the terminal. 

    Here are some steps to clarify: 

    1.Create your Azure Resource Manager (ARM) Template 'azuredeploy.json':
    When you create your ARM template, save it in a directory of your choice on your local machine. For example, you might have a project folder where you keep all your code and related files. 

    2.Open Git Bash:
    Open Git Bash and navigate to the directory where you saved your 'azuredeploy.json' file. You can use the 'cd' command to change it to the appropriate directory as shown in the following screenshot: User's image It should reflect in this manner: User's image User's image We have done practically from our end successfully, kindly follow the steps as per the exercise. Sharing the screenshot below for your reference: User's image User's image

    If you are still facing any issue, please let us know in the comments.

    Please Accept Answer so that it would be helpful to community members.

    Thank you.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Rakesh Gurram 11,815 Reputation points Microsoft Vendor
    2024-01-23T07:19:42.22+00:00

    Hi Sereysothea So,

    Thank you for reaching out to us on Microsoft Q&A forum.

    From your question we understand that you are trying to create an ARM template and facing the error "No such file or directory: azuredeploy.json". While following the steps make sure that the file azuredeploy.json should be in "present directory" where you are trying to execute the following command: User's image

    We have tried from our side and were able to execute it successfully as shown: User's image

    If you are still facing any issue, please let us know in the comments. If the information is helpful, please accept the answer by clicking the "Accept Answer" on the post.

    Thank you.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.