How to update VM config via bicep #4659
Replies: 5 comments 7 replies
-
I am not totally clear on the scenario, however it sounds like you would like to be able to export Bicep configuration directly from the portal, then use that in a new deployment? Currently you would have to export out the ARM json, then bicep decompile that to a Bicep template. That would also need some cleanup as part of the overall process. The sooner that you can standardize how VM's get deployed originally, would mean that you don't have to repeat this process. if you have mixed types of deployment configurations, then you need to build conditional statements into your Bicep templates to handle more than a single scenario e.g. different OS, different disk images, different disk configurations. As an example if you look at this VM Bicep template. https://github.com/brwilkinson/AzureDeploymentFramework/blob/main/ADF/bicep/VM.bicep Below is a common pattern |
Beta Was this translation helpful? Give feedback.
-
Let me explain this with an example if I have to create 30 vms all will have different configs and to deploy them we have created 2 vm template one for Linux and one for windows while we create vms we use parameters files and change the parameters for each deployment. Now the vm gets created in azure which is the end result via bicep but using a template how do now I manage those individual vms via bicep or IaC now ? Because you see we don’t have individual bicep file for those 30 vms where I can add or remove something only way out is to decompile and then make changes , how do I get pass through this step create individual bicep files for all the vms and then manage ?
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Ben Wilkinson ***@***.***>
Sent: Thursday, September 30, 2021 1:32:04 AM
To: Azure/bicep ***@***.***>
Cc: Rohit Kumar ***@***.***>; Author ***@***.***>
Subject: Re: [Azure/bicep] How to update VM config via bicep (Discussion #4659)
I am not totally clear on the scenario, however it sounds like you would like to be able to export Bicep configuration directly from the portal, then use that in a new deployment?
Currently you would have to export out the ARM json, then bicep decompile that to a Bicep template.
That would also need some cleanup as part of the overall process.
The sooner that you can standardize how VM's get deployed originally, would mean that you don't have to repeat this process.
if you have mixed types of deployment configurations, then you need to build conditional statements into your Bicep templates to handle more than a single scenario e.g. different OS, different disk images, different disk configurations.
As an example if you look at this VM Bicep template.
https://github.com/brwilkinson/AzureDeploymentFramework/blob/main/ADF/bicep/VM.bicep
Below is a common pattern
[image]<https://user-images.githubusercontent.com/3605266/135340053-219967d0-27aa-4693-8441-b4c188d94ce0.png>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#4659 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AFFQL2VC6DKYE3KYDRK7SFDUENWDZANCNFSM5E7WAJ5Q>.
|
Beta Was this translation helpful? Give feedback.
-
Oh now I believe what you mean so your bicep vm template is going to work as the picture of your vm and if you want to add anything to it rerun the template with the changes that you want to see in that vm say add additional disk and it is only going to modify that part and not going to recreate the entire vm again does that sounds right Ben ?
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Ben Wilkinson ***@***.***>
Sent: Thursday, September 30, 2021 5:17:32 AM
To: Azure/bicep ***@***.***>
Cc: Rohit Kumar ***@***.***>; Author ***@***.***>
Subject: Re: [Azure/bicep] How to update VM config via bicep (Discussion #4659)
if you do have a Bicep template, you just redeploy with it over the top of the current vm's.
if you have a ARM/Json template, then you decompile that to a Bicep file... then deploy that.
Either way you can use the same parameter file.
if you only want to deploy a subset of VM's then comment out the ones that you don't want to deploy in the parameter file or implement some kind of condition to only deploy certain resouces.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#4659 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AFFQL2QVPPYCWXHJCY74SU3UEOQRJANCNFSM5E7WAJ5Q>.
|
Beta Was this translation helpful? Give feedback.
-
Thanks Ben,
Last piece of this puzzle , (is what I think) I am trying to use this parameter file , where I want to give a password at the time of deployment , but if I give $true , Null or False it gives me error and I can create a VM only when I put a password in the value section.
How do we by-pass this , we definitely plan to use key vault but that is later . I am using a secure parameter as well but I get an error every time I try to deploy it .
"virtualMachineSize": {
"value": "Standard_A2m_v2"
},
"adminUsername": {
"value": "linuxadmin"
},
"adminPassword": {
"value": ""
}
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
From: Ben ***@***.***>
Sent: 30 September 2021 05:35 AM
To: ***@***.***>
Cc: Rohit ***@***.***>; ***@***.***>
Subject: Re: [Azure/bicep] How to update VM config via bicep (Discussion #4659)
Yes that is correct. So long as you deploy the template into the same resource group with the same name then it will just validate and update the current resources. That is the main benefit of Declarative template deployments. You templates contain your configurations and you just update those and redeploy them as needed to push new settings.
If you are not familiar with this process, start with a sample template deploy it once, then make and update and deploy it a second time.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#4659 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AFFQL2XGOEEB6UA4U5K4Y43UEOSV5ANCNFSM5E7WAJ5Q>.
|
Beta Was this translation helpful? Give feedback.
-
Thanks Ben … I will test and update thanks a lot
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Ben Wilkinson ***@***.***>
Sent: Tuesday, October 5, 2021 11:54:05 PM
To: Azure/bicep ***@***.***>
Cc: Rohit Kumar ***@***.***>; Author ***@***.***>
Subject: Re: [Azure/bicep] How to update VM config via bicep (Discussion #4659)
Let me know now you go with your testing?
if you are looking for a test template this one should work for your needs
https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.compute/vm-copy-managed-disks
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#4659 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AFFQL2T4OM7NQPBSBDZQSETUFM7ELANCNFSM5E7WAJ5Q>.
|
Beta Was this translation helpful? Give feedback.
-
I have an environment where I have these folder vnet, vms , routing etc ... if I need to make changes to Vnet via VS code I can make and update the repository because the configuration exists there what I need to do in case I need to update a VM config from VS code as what I have in VMs folder are not complete VM config but only templates from where I create multiple Linux and Windows VM ....I know about using existing keyword but how do we get the vm bicep code where we need to make changes ?
Beta Was this translation helpful? Give feedback.
All reactions