DevTest Labs - Custom image with 2 NICs - azure

I know DevTest Labs is still in Preview, but I'm currently trying to develop using the latest functionalities from Azure (not classic).
I have my own linux VHD and I decided to created a custom image under DevTest Labs. For my VM to work properly I need to add a secondary NIC to it, but I couldn't see any option/functionality to do so. I'm assuming there's another hidden way to create a secondary NIC(with Powershell, xplat-cli, wizardry..)or worst case scenario, there's no way to create a secondary NIC.
Any input if that's even possible yet ?

The primary building block of Azure Resource Management model is the Resource Manager Template, if you create a template that specifies the solution you want to create you can import that template into DevTest labs. Then deploy that as needed.
You could use this template as a starting point there are plenty of others at the Azure Quickstart Templates Site
They take a little hacking and getting used to, but once you figure them out they are a good way of managing resources.
There is also a an ARM template visualiser which is starting to get quite useful.

Related

Azure Update Management - Automated VMs onboarding

I am trying to automate VMs onboarding process for Azure Update Management. I am wondering if it possible, I didnt find solution which I can use to full onboard VM to Update Management, from A-Z. I mean I need MMA agent installation (i have script prepared, for installing mma vm extension with workspace ID and Key). Problem is that thare I didn't find a way to perform rest of the steps. Did anyone try to do this, I know that Ms give the runbook form this but I am not sure if its working as expected, link here --> https://learn.microsoft.com/en-us/azure/automation/update-management/enable-from-runbook
You can automate it by configuring UM to automatically enable for all existing and future VMs using this method - Enable Machine in the workspace
But keep in mind that using this method doesn't allow you to have the control an enterprise customer would want.
We don't have an out of the box method to configure from the VM, onboarding it to UM in an automated manner. Based on how it is designed, the only way out of the box is from the portal, or runbook as described in docs.
Programatically to work around this (and I'm thinking out loud here) you could update the saved search query - MicrosoftDefaultComputerGroup in the workspace with the UUID of the VM and that would automate onboarding it to the feature. I don't have a working example to share but I think the approach is sound and can be included in the workflow to onboard it.

Get ARM template for a specific API in Azure API Management

In the Azure API portal there is the Automation script tab, but that generates the ARM template for the entire resource group. It also includes a lot of other stuff that needed.
Is there a (simple) way to get hold of the ARM template for a specific API rather than the entire resource group? Can it be done through Azure cli? the REST API?
Yes, use the Azure Resource Explorer to locate your resource, the Uri at the top of the page will provide you a link to the template (requires authentication if you want to call it from outside of Resource Explorer).
I also always refer back to the reference documentation on ARM templates, it is a very good place to start from. Whilst it doesn't give you your exact template, it does give you a very clear base to start from (example below). I find this far more productive that trying to read the templates in the Automation Script" section of the portal.
Good luck.
No, you cannot do that. there is only 1 resource provider action to export and it exports the whole resource group. just remove all the extra parts.

Azure arm intelligent provisioning

I'm trying to set a standard virtual machine template via ARM deployed on the azure portal and feel I'm missing a trick.
When deploying a virtual machine via azure you can select existing vnets and based off your selection you can select a subnet.
Via the ARM template deployment method I do not see a way other then putting all the subnets in the allowed values and hoping the end user chooses the right one.
Can anyone help?
theres no easy way of doing this currently. Managed Applications might be of a value there, but they are not exactly arm templates. But they have some controls to allow for "smart" value picking.
I suppose I can generate a powershell script that queries azure dependant on selections and fill in the arm template from said selections. Just would be nice if could have built in the intelligence within ARM deployment.
Thank you for the managed applications information

How to retrieve deployment username in azure vm template

I'm currently building out a number of virtual machines in azure using a template that we've built out. I would like to be able to pull the name of the user who chose to deploy this template so that we can verify a number of things exist on the server for them (i.e. userid). Is there anyway to do this? Any help would be appreciated.
No, this is not possible using arm templates (unless using some pretty horrible\unreliable\outside of arm template hacks).
You could probably work around that by creating a parameter where user inputs his details, but even that the second part of your plan will fail. You cannot really do checks on the OS level configurations from the template.
ARM templates aren't meant to actually check things, and while some interactions are possible, they are very limited (like listKeys).

Azure Vitual machine deployment

Azure resource manager power shell or JSON template to create Virtual machine in existing Virtual network and Storage account.
You can of course use either.
Json Template is basically what Azure Resource Manager (ARM) uses anway. Bonus: you can run your ARM templates from PowerShell :)
The question you want to ask is:
Will I be doing this repeatedly?
If so, ARM is the natural answer. You create a resource in a file that you can version control and use to repeated deployments.
If it's only a one-time thing, then PowerShell or Azure Command Line Tools are more than enough.
At first steps JSON templates may confuse you, because files are large (hundreds of lines). But templates are really readable and you can easy configure your architecture. Also there is a chance to make a syntax mistake or to violate existing restrictions - try to use smart editor.
For example, VS Code Editor.
PowerShell and multi-platform tool Azure CLI help you make the same requests to subscriptions but contain helpers, hints and validators which would help you easy set correct options.

Resources