Creating a Minecraft server using the new Azure portal

 :: Posted by John Savill on 04-17-2015

A couple of years ago I wrote a basic set of instructions on creating a Minecraft server in Azure. I felt it was time to create a new set of instructions based on the new Azure portal. You need an Azure subscription to follow this tutorial, this could be a subscription you pay for, Azure benefits that are part of an MSDN subscription or even an Azure trial subscription which can be signed up for from http://azure.microsoft.com/en-us/pricing/free-trial/.

Once you have a subscription follow the steps outlined below:

Login to the new Azure portal at https://portal.azure.com. When you first login you will be at the Azure Startboard. Also notice the hub menu on the left hand side which enables access to various resources within Azure. At the bottom of the hub menu is a New button which enables all the different types of Azure service to be created.

AzureStartBoard

Click the New button and under Browse select Compute which opens up the Compute blade with a list of images. Select the Windows Server 2012 R2 Datacenter image.

newcomputer2012r2

The Create VM blade will open which enables the configuration for the new VM to be selected. Notice in the Create VM blade there are some basic properties to be completed such as the name for the VM, a username and a password. Additionally there are options for the size of the VM, optional configurations and location.  The hostname can be anything you wish, for example Minecraft. Enter a username, it cannot be Administrator as this is reserved but could use localadmin. Enter a complex password which needs to be at least 8 characters with a mix of three of the following; lowercase, uppercase, numbers and symbols.

Select the Pricing Tier part to open the pricing tier lens which enables the size of the VM to be selected. The A1 Basic is sufficient for basic testing however if you wanted to host more players the Standard A2 may be a better fit. Standard tier VMs have higher storage IOPS and network performance in addition to load balancing and scale capabilities (which we don’t use for our single instance Minecraft server). Notice there is a View all link to show all the available VM sizes. Select a VM size and click Select.

newvm1

By default a new virtual network is created for the VM along with a new cloud service which owns a Virtual IP that is accessible from the Internet and a random name is selected for the cloud service DNS name. Select Optional Configuration – Network – Domain Name – Create new domain name and type in a name. The name must be unique across all of Azure. You could try Minecraft-<your name> and click OK. As you type the name it will be checked to ensure its unique. This name will be how you can connect to your server, <name>.cloudapp.net. Click OK to the Network blade. Notice by default a new Storage Account will be created to store the virtual hard disks for the new VM however you could change this if desired.

newvm2

On the main Create VM blade select the Location part. This enables the Azure region to be selected where the new VM will be created. Notice there are Azure regions throughout the world so pick one closest to you (or your players!). Close the blade. By default a checkbox is selected “Add to Startboard” that would add the new VM to the Startboard of your subscription. Click Create to create the VM.

The VM will now be created and will take around 5 minutes to be fully provisioned and ready for use. By default the VM will have an OS disk that is 127 GB in size and a temporary disk, the D: drive. Never put any data you care about on the D: drive as this is not persistent and by default will only be used for the pagefile. The OS disk has read and write caching enabled. You can also add data disks which have configurable caching options including no caching which is what is needed for databases and other types of workload that need writes to be persisted directly to disk. We will add a data disk to our Minecraft server for our Minecraft binaries and data files. You will need to wait for the VM to be created before adding the data disk. Select the VM which will open the VMs build and under the Essential lens (a lens is a group of parts that share a common theme) select the All settings link which opens the Settings blade.

Select Disks in the Settings blade and select the Attach New action. By default the maximum size of 1023 GB for a disk is selected with caching disabled. Select the Storage Container part – Choose Storage Account and select the storage account that you used for the Minecraft server. For the Container select the default vhds container. Click OK to create the new data disk. You may wonder why 1023 GB since you have to pay for storage in Azure and your Minecraft world may only be 50 MB which means it would seem you are paying for a lot of wasted space. This is not the case as Azure actually uses sparse storage which means even though you are creating a 1023 GB VHD file in Azure Storage behind the scenes storage is only actually allocated for the data written which is what you pay for.

newvm3

Your VM is now created and has a data disk added to it. The next step is to connect to the new VM. In the VMs blade select the Connect action. This will download an RDP file which can either be opened or saved to disk so the exact options such as display size etc can be changed. The RDP file is populated with the DNS name of the cloud service that contains the Minecraft VM and the port for the RDP endpoint for the specific VM.

vmactions

You are now connected to your Azure VM. Open Explorer and you will see your OS C: drive and the temporary storage drive D: but the data disk we added is not shown because it has not yet been initialized or formatted. Open the Disk Management MMC snap-in (Start – Run – diskmgmt.msc). When the snap-in opens it will inform you of a new disk and offer to initialize. Click OK. Once the disk is online right click on the disk and select New Simple Volume. Except all the defaults. Notice on the Format Partition dialog enter a label for the Volume label such as Data and make sure “Perform a quick format” is selected. This is critical in Azure as remember that sparse storage? If you don’t perform a quick format every block of the disk will be written to which means you would then pay for the full 1023 GB size. Complete the dialogs to create the new data disk.

formatquick

Navigate back to Explorer and the data disk will now be visible. Select the data disk and create a folder called Minecraft.

Open Internet Explorer and navigate to https://minecraft.net/download. In the Multiplayer Server area download the latest server binary and save to the Minecraft folder that you created on the data disk. I normally rename this download to minecraft_server.exe and remove the version number from the name. You also need to download and install Java. This can be downloaded from https://www.java.com/en/download/manual.jsp and select the 64-bit version. During the Java installation you likely want to unselect the options to install and set Ask as the default!

You are now ready to get Minecraft running. I recommend creating a batch file to launch the Minecraft server which will configure it to use more memory. I save the following to a file (minecraft.bat) and place in my Minecraft folder. This launches Minecraft server and set it to use 2 GB of memory:

“C:\Program Files\Java\jre1.8.0_45\bin\javaw.exe” -Xms2048m -Xmx2048m -jar “Minecraft_Server.exe”

Run the batch file. Once it has run open the eula.txt and change the false to true then rerun the minecraft.bat file which will now launch the Minecraft server service however it is not usable yet.

Minecraft clients communicate to the server on port 25565 which by default is blocked by the Windows Firewall. You need to create a firewall exception. Click Start and type firewall. This will find the Windows Firewall with Advanced Security application. Launch it. Select Inbound Rules and select the New Rule action. Select a type of Port in the New Inbound Rule Wizard and click Next. In the next page select TCP and type in port 25565 then click Next. Accept the defaults to Allow and for all types of profile and on the final page enter a name of Minecraft Server. Click Finish.

firewallport

There is one final action. The VM created sits within a cloud service and the cloud service has the publically accessible IP address. Endpoints are created on that IP address which enable communications on specific ports to be forwarded to specific ports on VMs in the cloud service. You already used one of these endpoints when you RDP’d to the VM earlier, that is using an automatic endpoint that was created to enable RDP access to the VM from the Internet. We will add a new endpoint for the Minecraft port. Open the VMs blade in the Azure portal and select All settings. Select Endpoints where you will see the existing endpoints created. Click Add. Enter a name of Minecraft and set the public and private port to 25565 then click OK.

endpoint

You are now ready to use your new Minecraft server. Launch the Minecraft client and select Multiplayer. Click Add Server and for the Server Address use your cloud server DNS name, e.g. minecraft-savill.cloudapp.net and click Done.

minecraftclient

Select your new server and click Join Server.

minecraftclient2

And play!

minecraftclient3

As an optional step you probably want to make yourself an operator for your server. Add to the ops.json file. http://conoroneill.net/creating-a-valid-ops-file-in-json-format-for-minecraft-179 walks through this process and links to http://minecraft-techworld.com/uuid-lookup-tool to find your UUID for your account.

For more information on Azure check out my new book and free Windows application.

AzureBookCover AzureAppPicture

 

 

 

Azure Network Security Group and Fault Domain videos

 :: Posted by John Savill on 04-16-2015

Created two new videos. One on Network Security Groups, the other on understanding Fault and Update Domains in Azure. Enjoy!

Two new Azure videos

 :: Posted by John Savill on 04-09-2015

Create two new videos.

Azure Preview Portal Walk-through – https://youtu.be/6kkq-AEHetc

Azure Site Recovery Walk-through – https://youtu.be/ErYUPsyGazA

Mastering Azure IaaS Windows 8.1 App Available!

 :: Posted by John Savill on 04-07-2015

In preparation for my new book, Mastering Microsoft Azure Infrastructure Services (http://www.amazon.com/Mastering-Microsoft-Azure-Infrastructure-Services/dp/111900327X/) which comes out end of this month I have completed the companion application.

The application contains all the links and code from the book in addition to videos to help understand the concepts. The app checks for updated content each time it launches and I’ll be continually adding new content to the app so check it often.

You can download the application at http://apps.microsoft.com/windows/en-us/app/mastering-azure-iaas/da00e633-4a99-4194-86c5-71f17b723ad8. or search the Windows Store for SavillTech.

AzureIaaSApp

I also updated the Hyper-V application with a bug fix related to scrolling at http://apps.microsoft.com/windows/en-us/app/mastering-hyper-v-2012-r2/fe7f6602-1c88-412e-9d88-4cc83480e402.

 

Overview of Azure IaaS in 60 minutes

 :: Posted by John Savill on 04-07-2015

Created a new whiteboard based video going over the fundamentals of Azure IaaS. See it at https://youtu.be/kp3XgyCOTGg.

Deploy Office with Configuration Manager

 :: Posted by John Savill on 04-03-2015

Just created a new video on deploying Office with Configuration Manager and it covers both the MSI based version and the click-to-run. See it at https://youtu.be/uFshStS5XNQ.

Three new videos on various “stuff”

 :: Posted by John Savill on 10-05-2014

Been swamped lately as started writing a new book, Mastering Azure Infrastructure Services and also doing a few other projects but this weekend recorded three videos related to a few different topics including Windows 10 Virtual Desktops, Azure Auto-Scale and Operations Manager to Service Manager Alert Lifecycles! Enjoy.

New Demo integrating a hybrid VM deployment with Windows Azure Pack

 :: Posted by John Savill on 07-15-2014

Decided to play with the Windows Azure Pack and specifically offer a hybrid VM deployment which would deploy either via SCVMM to a cloud OR deploy to Azure depending on if the user desired high availability for the VM. I walk through this in video http://youtu.be/wLANreQyk3c and mini version can be seen below.

I uploaded my runbook to http://www.savilltech.com/downloads/hybridvm/CreateVM_Cleaned.ois_export and the sample RDP file to http://www.savilltech.com/downloads/hybridvm/TemplateRDP.rdp.

If you decide to play with this there are a number of things you need to do:

  1. The Orchestrator service account needs to be a SCVMM administrator (as it interfaces via PowerShell to update VM status)
  2. You will need configurations in Orchestrator for Service Manager and SCVMM
  3. You will need to have downloaded your Azure publish settings file which you can do with command Get-AzurePublishSettingsFile and should save this as c:\data\Microsoft Azure Subscription.publishsettings (if you follow my standard configuration)
  4. You need the Azure and SCVMM PowerShell cmdlets installed on the Runbook server or whatever server you configure the PowerShell to run on (I use localhost which means it runs on the runbook server but in larger environment you would likely have a specific PowerShell server(s) )
  5. There are lots of places in the PowerShell with < > that you need to replace with your values and ideally in Get Clouds for user you should use real logic to set values!
  6. In Create Azure VM you need to replace subscription name with your own name as in the Azure Publish Settings File
  7. Make sure the same RDP file is in c:\data as used in Create RDP File activity
  8. Make sure the users in AD have the mail attribute populated

Also I really don’t have error handling in this runbook, it was more a demonstration of what can be done and integration with Windows Azure Pack. I also enabled ADFS for my Windows Azure Pack tenant site and I’ll write that up as a FAQ on http://www.ntfaq.com over the next 2 weeks. I already have FAQs on installing Windows Azure Pack.

This runbook was done as one long runbook. Normally you would not do that, you would have separate runbooks but to demonstrate the flow and how simple it really is I left it as one big runbook but wanted to be clear this is not best practice.

CreateVMRunbookPicture

 

Have fun!

A whole bunch of stuff with Service Manager

 :: Posted by John Savill on 05-24-2014

It started out very simple. I was preparing for a client that wanted to allow business groups to schedule the deployment of patches to their servers via Configuration Manager using Orchestrator and Service Manager with some approval workflow. This seemed the right approach and I decided to quickly setup a little example of what this would look like but instead of using Configuration Manager I decided to just be able to run any PowerShell command on the computers in the passed Active Directory group (which contained the computers for that business group). The final solution is walked through at http://youtu.be/RFLhyMhJOOc and I have a bunch of assets listed below:

The example runbook is available at http://www.savilltech.com/videos/RunActivity.ois_export

The example PowerShell is available at http://www.savilltech.com/videos/RunCommand.ps1

The example email approval template is available at http://www.savilltech.com/videos/RequestApproval.txt

I wanted to briefly go over the key steps here that are walked through in the video:

Firstly I decided to do the actual logic of finding all the machines in the passed AD group using PowerShell and within the PowerShell actually perform the actions. You could have done this with Service Manager activities but the direction is PowerShell so I decided to implement the main logic in PowerShell but use Orchestrator activities for interacting with Service Manager such as update Service Request status etc. The basic PowerShell is below:

$ADGroupName = “FileServicesGroup”
$CommandToRun = “mkdir c:\johntest”

$ScriptBlockContent = {
param ($CommandToRun)
Invoke-Expression $CommandToRun }

$ADGroupMembers = Get-ADGroupMember -Identity $ADGroupName
foreach ($computer in $ADGroupMembers)
{
#Run the required command on each computer in the group
Invoke-Command -ComputerName $computer.name -ScriptBlock $ScriptBlockContent -ArgumentList $CommandToRun
}

In this basic PowerShell I am hardcoding the AD group and the command to run but when it gets into Orchestrator I’ll replace that with the information sent from Service Manager. Note I use a parameter to pass to the scriptblock since the actual variable is local to my PowerShell session and NOT the one I create remotely on each machine.

I then create a runbook in Orchestrator which essentially uses this PowerShell which also hooks into Service Manager to update the Service Request status.

In Service Manager I synchronize with Orchestrator to get the Runbook in the library then create a Runbook Automation Activity template and then a new Service Request template which has two activities. The first is a review activity which is for the submitting users line manager (as defined in Active Directory) and the second calls the Runbook Automation Activity template and defines the Runbook ID (RBId) and the Service Request ID (SRId) which is the Work Item – ID for each of the respective values. This is shown below.

IdMappinginSRTemplateforRBActivity

Because when this all runs via Orchestrator it runs as the Orchestrator service account I made the Orchestrator service account a local administrator on each server using the Group Policy Preferences local group feature and added the service account. Other options could have been to specify a credential as part of the actual Invoke-Command within the PowerShell but I liked the Group Policy option.

gpoadmin

I wanted to use Office 365 and I walk through the basic steps in a FAQ at http://windowsitpro.com/service-manager/connect-service-manager-office-365

I created email templates for the review activity and notification the Service Request is complete and then configured those to be used as part of the workflows.

I created Request Offerings and Service Offerings and the key point is for end users to see them I created new Catalog Groups, one for Request Offerings and one for Service Offerings that dynamically added all published of each type. I then created a new User Role that was for all Domain Users that included both those new Catalog Groups.

I then walk through it all!

AGAIN DO NOT DEPLOY THIS IN PRODUCTION.

THE ABILITY FOR ANY USER TO RUN ANY COMMAND ON EVERY SERVER IN A PASSED GROUP IS VERY BAD. THIS WAS AN EXAMPLE ONLY !!!!

This is an example only and you should modify the actions performed in Orchestrator to your own specific needs.

And the video:

Mastering Hyper-V 2012 R2 is available!

 :: Posted by John Savill on 04-28-2014

Just wanted to let everyone know my new book is now available. I also wrote a Windows 8.1 application that is free and complements the book offering videos, links and PowerShell for everything referenced in the book which is available at http://www.savillte.ch/mhv.

master2012r2hypervscreen

Let me know what you think!

MasteringHyperV2012R2Cover