From the course: Azure Infrastructure as Code with GitHub

Use parameters

- [Speaker] When we work with bicep files, most of the times we will use parameters, because that's what gives that bicep file flexibility, otherwise, every time we deploy it, we would deploy exactly the same thing, and we'd use a lot of bicep files for all the resources that we might need. If we look at our current file, main.bicep, we see the parameter at line two, which is storageAccountPrefix. It has a default value of bicep, it's why we actually don't need to define a parameter. But if we do want to add a parameter into the file, there's two ways we can do that: we can use a parameter file, or can do it directly in the action. In this case, we're going to see how we can do that in the action. And let's remember, the parameter is called storageAccountPrefix, and I'm going to copy this value to make sure that I don't make a typo. If we move back to the main code, here we can find the workflow we just created. So this is the action file, the workflow that we just used, and we're going to edit it. If I click the edit button here, it will open up that interface that we had before with the marketplace on the side. If we scroll down to the step we used before, to deploy Azure Resource Manager template step, we can add extra values here. If we're not sure what they were called, we can look back in the marketplace at the syntax of that action. So we will search for it, (keyboard key clicking) change the version to the last version, and here we can find all the parameters that we could use. And this is the one we need, parameters. So let's just copy and paste this part and add it here. As you can see, the indentation is wrong, but we can still use our little trick of just pressing space bar (space bar clacking) until it's at the right place. And we see now the error is this value can't be null. So let's add a value here. There's two things we can do now: we can now add a path to a parameter file that we have in our repository, or we can add the parameters right here. So let's add the parameter here, (keyboard clicking) add an equal sign, and then we can set the value for this parameter. So let's call this GitHub action. Remember, this is a storage account so it needs to be all lowercase. So we can now commit our changes at the button at the top of the screen. We commit, and because the workflow is set to trigger each time something is pushed, the action should now be running. Let's check it out at the actions menu. (computer mouse clicking) We look at the deploy, and it is now running. All right, and our workflow is done, so we can now move back to our Azure window and look at the overview, and we now have two storage accounts. And as you see, the one we had before is still there, and now we have one with the new prefix that we just added into the pipeline.

Contents