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.
Related
I am working on IaC in Azure. I need to create a user group via ARM template. Is it possible to accomplish this task in this manner?
Unless something has change recently, no. You can use the MS Graph API. You can set up PowerShell Scripts to run. Etc. And if you need this as part of the pipeline, there is likely a plug in on marketplace, if keyed on pipeline.
But I am trying to understand the need for creating a new group as part of the IaC. Is this because you need it configurable for different types of installs through pipelines? In general, I don't mix security with infrastructure unless I am making a product for others to install, so just trying to make sure you are not heading down a bad road.Do you mean resource groups instead?
I want to create an automation demo for customers, where I have a single page web app with a couple of input text fields, and the inputs get used as parameters in the creation of an Azure Resource Group and VNETs/VMs/etc within the Resource Group.
I can do all of the above with Azure CLI (v2.0) on my laptop, and also from CLI using a Azure CLI in a bash script on a Linux server, but I wanted something web-based. I considered standing up a web page on the Linux server to call the bash script, but that seems a bit painful (especially with permissions etc). I also thought maybe Azure Functions could provide a solution to host the single web page app and call the Azure CLI commands, but I've never used Functions before so not sure if Functions can do this; the description of Functions' capabilities aren't clear to me.
What is the best way to achieve what I'm after, quickly?
Note I'm not a developer, I'm a network engineer, so whilst I can hack around in a few languages from Notepad and vi, I'm not looking to build something in a full SDK, or have something with enterprise-level reliability, version control, etc. This is really all about proof of concept and web-based demo of something I already have in Azure CLI / bash script.
Thanks in advance :-)
For a quick and relatively dirty way, you could create an Azure Runbook (using the scripts created from the Azure Portal) and invoke using the Automation API This could use the scripts (or close to) what you already have.
When you roll out a new service in Azure you get the option now to download the Automation Script, you can then follow this article to deploy the generated script via a runbook
To follow on from Jamie's idea.
You can code your Azure Cli script (or Powershell) into an Azure Automation Runbook, you can have variables etc to access it with.
You can then attach a webhook to that runbook, and call it from a standard HTTP Post request.
Meaning you could create a HTML form, that would pass whatever variables are required and build whatever is needed.
The downside of this would be that you will be creating it on your infrastructure.
You can have a solution that will deploy to someone else's infrastructure with a deploy to Azure button
This lets you host it in Github etc, it takes a bit more knowledge to make it work but saves your account dollars!
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).
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.
Is there any way to save the complete state of my azure configuration?
Basically, I just created a demo for a project I'm working on. This demo has a website/webjob, scheduler, storage queue, storage blob, redis cache and documentDB. I have configured these components in terms of size/scale/schedules but now the demo is done.
I don't want to pay for these services and I don't need them online for now. However, I don't want to have to recreate and reconfigure them if I need to relaunch the demo in a month.
Is there a way to save my current azure configurations to a file and then to be able to recreate all the services again automatically (with a script or a small program)?
Thanks!
This is a very good question, that sums up a historical problem we're in the process of making easier and more flexible. I'll answer this question with two parts.
First and foremost, you have tools like the PowerShell cmdlets now, that you can script out the creation of an entire "world" in Azure and then re-run whenever you want, against a subscription, to scaffold out a whole architecture. You can also use the management libraries for .NET to do this from a .NET application. When we embarked on the VS WebJobs tooling, for instance, I worked up a prototype for my developers on using MAML to create WebJobs and scheduler job collections. You can see the demo code for that here: https://github.com/bradygaster/maml-demo-scheduled-webjob-creator
We've also recently embarked on new mission of re-creating a lot of the management APIs so that they support the notion of templates and resource groups, to marry up with the new portal experience. Here's a great MSDN article that discusses how the PowerShell cmdlets for the Gallery could be used to pull down a list of the various templates that could then be pushed back up as fully-baked architectures running in Azure. You have the capability of building these templates yourself, then you could use these cmdlets to fan out and create things that you write up in your own custom templates. http://msdn.microsoft.com/en-us/library/dn654596.aspx
Hope this helps!
For Azure websites you can use the Back and Restore option to store the site and restore it back when you want to demo again, But all you have to do is Stop the services and you should be able to keep the demo without incurring cost.