Reader small image

You're reading from  Windows Server 2016 Automation with PowerShell Cookbook - Second Edition

Product typeBook
Published inSep 2017
Reading LevelBeginner
Publisher
ISBN-139781787122048
Edition2nd Edition
Languages
Right arrow
Authors (2):
Thomas Lee
Thomas Lee
author image
Thomas Lee

Thomas Lee is a consultant/trainer/writer based in the UK and has been in the IT business since the late 1960s. After graduating from Carnegie Mellon University, Thomas joined ComShare where he was a systems programmer building the Commander II time-sharing operating system, a forerunner of today's cloud computing paradigm. In the mid-1970s, he moved to ICL to work on the VME/K operating system. After a sabbatical in 1980/81, he joined Accenture, leaving in 1988 to run his own consulting and training business, which is still active today. Thomas holds numerous Microsoft certifications, including MCSE (one of the first in the world) and later versions, MCT (25 years), and was awarded Microsoft's MVP award 17 times.
Read more about Thomas Lee

 Ed Goad
Ed Goad
author image
Ed Goad

Ed Goad is a systems architect who has been working in various roles in the IT field for 16 years. He first became interested in scripting and automation when presented with a task to uninstall software from over 1,000 systems with limited time and resources. He has worked with scripting and automation on multiple platforms and languages including PowerShell, VBscript, C#, and BASH scripting. Ed currently holds multiple Microsoft certifications, most recently including the Microsoft Certified IT Professional Enterprise Administrator. Additional non-Microsoft certifications include VMware Certified Professional (VCP), Red Hat Certified System Administrator (RHCSA), EMC Proven Professional, Brocade Certified Network Engineer (BCNE), and Cisco Certified Network Associate (CCNA). Ed is currently on a sabbatical and volunteering full time at the Amor Fe y Esperanza school in Honduras(http://www.afehonduras.org). There he is teaching computer and math classes to the kids who live and work in the garbage dump outside of the capital city of Tegucigalpa.
Read more about Ed Goad

View More author details
Right arrow

Chapter 12. Managing Azure

In this chapter, we cover the following recipes:

  • Using PowerShell with Azure
  • Creating core Azure resources
  • Exploring your storage account
  • Creating and using an Azure SMB file share
  • Creating and using Azure websites
  • Creating and using Azure virtual machines

Introduction


Azure is Microsoft's cloud computing platform and is a competitor to Amazon's Amazon Web Services and other public cloud providers, Azure provides you with access to a huge range of features. Organizations can literally move their entire on-premises infrastructure into the cloud. 

Azure features come at three levels:

  • Infrastructure as a service (IaaS)
  • Platform as a service (PaaS)
  • Software as a Service (SaaS)

IaaS is, in effect, an instant computing infrastructure that you can provision, manage, and use over the internet or via a private network connection. IaaS includes the basic computing infrastructure components (servers, storage, networking, firewalls, and security) plus the physical plant required to run these components (power, air conditioning, and so on). In an IaaS environment, the servers are all Azure virtual machines (effectively Hyper-V VMs) and interact with the networking, security, and storage components.

PaaS is a complete deployment environment in the cloud, including...

Using PowerShell with Azure


There are two key things you need to do before you can begin to manage Azure features using PowerShell. The first is to obtain an Azure subscription. The second is to get access to the cmdlets you need to be able to access Azure (and Office 365's features).

Azure is a commercial service—each feature you use has a cost attached. Azure charges are based on resource usage. With an Azure VM, for example, you would pay to have the VM running, with additional charges for the storage the VM uses and for any network traffic. The charges for Office 365, on the other hand, are user based—a given user can use lots of email, for example, without incurring any additional charges. For details on costs for Azure, see https://azure.microsoft.com/en-us/pricing/, and for details of Office 365 charges, see https://products.office.com/en-us/business/compare-office-365-for-business-plans.

To use Azure's IaaS and PaaS features, you need to have an Azure subscription. There are many ways...

Creating Core Azure Resources


In the previous recipe, you created and used the basic Azure management environment by downloading the key cmdlets, logging in to Azure and having a brief look around. In this recipe, you create certain key Azure assets, including a resource group, a storage account, and tags. With Azure, all Azure resources are created within a resource group.

A storage account is a fundamental building block within Azure. ALL storage you use with any Azure feature always exists within a storage account. You create a storage account within one of the Azure regions you saw in the Using PowerShell with the Azure recipe. When you create your storage account, you also specify the level of resiliency and durability provided. There are several levels of replication provided within Azure which provide for multiple copies of the data that are replicated automatically in both the local Azure data center but also in other data centers. The extra resilience, which does come at a price...

Exploring your storage account


Many Azure resources use Azure storage. In the Creating an Azure backup recipe in Chapter 5, Managing Server Backup, you saw how to use Azure storage to hold server backups. When you create an Azure VM, you store the VHD file in Azure storage. Azure storage accounts can hold a variety of types of data, with different mechanisms for managing each data type. Additionally, the storage account provides both scalability and data durability and resiliency.

Azure storage manages five distinct types of data:

  • Binary Large Object (Blob)
  • Table
  • Queue
  • File
  • Disk

A blob is unstructured data you store in Azure. Blob storage can hold any type of data in any form. This could include MP4 movies, ISO images, VHD drives, JPG files, etc. Individual blobs reside with blob containers which are equivalent to file store folders, but with no nesting capability.

Blobs come in three types: block blobs, append blobs, and page blobs. Block blobs are physically optimized for storing documents to...

Creating Azure an SMB File Share


Azure provides you with the ability to create SMB shares with an Azure storage account. These SMB shares act the same as local on-premises SMB shares you used in Chapter 9, Managing Network Shares. The key difference is how you create them and the credentials you use to access the shares.

Before an SMB client can access data held in an SMB share, the SMB client needs to authenticate with the SMB server. With Windows based shares, you either use a userid/password credential, or in a domain environment, the SMB client utilizes Kerberos to authenticate. With Azure, you use the storage account name as the userid and the storage account key as the password.

The storage account key provides you with two keys (imaginatively named key1 and key2). The value of either key is a valid password for Azure SMB file shares. You have two keys to enable you to do regular key rotation. If your application uses the value of key1, you can change the application to use the key2...

Creating and using websites


Azure provides a number of ways in which you can create rich web and mobile applications in the cloud. You could setup your own virtual machines, install IIS, and add your own web application. If your application needs to store data, you can create SQL Server VMs, or use Azure's SQL database feature—or any of the other database packages supported in Azure.

A simpler way is to create an Azure Web App. At one time, Azure offered what were termed websites. These were, as the name says, websites in which you could run your own application, or a host of others such as WordPress. These were single tier (possibly with a back-end database). However, Microsoft discontinued this feature and has replaced it with the more generic Web App feature.

Azure Web Apps enabled you to build, deploy, and manage rich websites and web applications. You can use frameworks such as .NET, Node.js, PHP, and Python in these applications and use any database software appropriate to your needs...

Creating and using Azure virtual machines


An Azure VM is essentially a Hyper-V VM that you run within Azure. There are some differences between Hyper-V VMs you create within Server 2016 (or Windows 10) and Azure VMs but they are minor. The ARM based cmdlets you use are a little different in style to Hyper-V cmdlets which may mean a bit of a learning curve.

At the time of writing, you can only use the VHD format for your virtual hard disks in an Azure VM although like many things in Azure this may change at some point in the future. Should you wish to move a Hyper-V VM into Azure that uses a VHDX hard disk file, you would need to convert the disk type to be a VHD.

In this recipe, you first create a virtual network. Your VM can have both a public IP address and a private VLAN based IP address. At the end of this recipe, you access the VM via the VM's public IP address. In a later recipe, you create a VPN and connect to the VM using the VPN addresses. You also create a NIC and give it a public...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Windows Server 2016 Automation with PowerShell Cookbook - Second Edition
Published in: Sep 2017Publisher: ISBN-13: 9781787122048
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Authors (2)

author image
Thomas Lee

Thomas Lee is a consultant/trainer/writer based in the UK and has been in the IT business since the late 1960s. After graduating from Carnegie Mellon University, Thomas joined ComShare where he was a systems programmer building the Commander II time-sharing operating system, a forerunner of today's cloud computing paradigm. In the mid-1970s, he moved to ICL to work on the VME/K operating system. After a sabbatical in 1980/81, he joined Accenture, leaving in 1988 to run his own consulting and training business, which is still active today. Thomas holds numerous Microsoft certifications, including MCSE (one of the first in the world) and later versions, MCT (25 years), and was awarded Microsoft's MVP award 17 times.
Read more about Thomas Lee

author image
Ed Goad

Ed Goad is a systems architect who has been working in various roles in the IT field for 16 years. He first became interested in scripting and automation when presented with a task to uninstall software from over 1,000 systems with limited time and resources. He has worked with scripting and automation on multiple platforms and languages including PowerShell, VBscript, C#, and BASH scripting. Ed currently holds multiple Microsoft certifications, most recently including the Microsoft Certified IT Professional Enterprise Administrator. Additional non-Microsoft certifications include VMware Certified Professional (VCP), Red Hat Certified System Administrator (RHCSA), EMC Proven Professional, Brocade Certified Network Engineer (BCNE), and Cisco Certified Network Associate (CCNA). Ed is currently on a sabbatical and volunteering full time at the Amor Fe y Esperanza school in Honduras(http://www.afehonduras.org). There he is teaching computer and math classes to the kids who live and work in the garbage dump outside of the capital city of Tegucigalpa.
Read more about Ed Goad