Quick tip for all potential Azure Stack Cloud Operators
As you’d be aware, essentially the majority of the Azure Stack extended setup requires PowerShell. Not only does managing Azure Stack require PowerShell, it requires specific modules, tools and PowerShell profiles…
Oh, did I mention Azure Stack management requires PowerShell?
This is typically fine, but if you’re anything like me and tend to use your computer (desktop/laptop etc) for many different functions, managing PowerShell profiles and having them all aligned can be a bit of a pain.
So over the last year or so I’ve had a lot of fun extending client environments to Azure. One of the methods I’ve used has been leveraging Azure Application Gateway (AAG) with Web Application Firewall (WAF) to protect these services.
The AAG’s with WAF have been a very fast and cost effective way for clients to deploy fast and protected services to Azure without the requirement for expensive 3rd-party WAF appliance licenses.
This is one I use regularly, so thought it might come in handy for you..
Assumption here is you are connected via PowerShell to your intended subscription..
A few key points:
The VM will need to be stopped to execute Check the Azure VM sizing to see how many NICs you can attach I have a pre-created Network Interface with my desired settings #Using OGV to target your objects $RG = Get-AzureRmResourceGroup | ogv -PassThru $NIC = Get-AzureRmNetworkInterface | ogv -PassThru $VM = Get-AzureRmVm | ogv -PassThru #The actual adding of the NIC to the VM $VM = Add-AzureRmVMNetworkInterface -VM $VM -Id $NIC.
Had a fun one for a client recently whereby they were standing up some new DNS servers for a segment of their network.
The forward lookup zones were very easy, import csv and PowerShell them in without much fuss at all..
Next came the Reverse DNS Zones.
Now let’s just say that their documentation wasn’t as up-to-date as it could have been, so the fun began when trying to go about importing them without having a reliable source of truth to go by.
I recently had the task of creating a PowerShell script to call REST API for adding Networks to an uplink set in HP OneView.
A quick overview of the environment.
Our enclosures have 4x FlexFabrics, 2 used to plumb an access port to the LOMs and 2 used as trunks to create the Virtual Switch teams.
The vSwitch uplink sets are labelled Switch_A and Switch_B
Each Vlan we connect is plumbed to each switch and named accordingly.
Found this one in my toolkit recently and thought I’d share. It’s a little old so the code could do with some optimizing..
What it does:
Prompts the script runner for a client number and then asks them to confirm the name for new management pack. If the operator types ‘yes’ (highly sophisticated coding) then a new management pack will be created with the desired naming convention
Our naming convention in this particular environment is to have all 3 client numbers at the beginning of the management pack name.
Along the same line as this post, the below will create an empty overrides management pack based on a source management pack and client number
These are meant for the SCOM operators to use for consistent management pack naming.
Enjoy Dan!
$ManagementServer = "SCOM01" $orgmanagementpackname = read-host "Enter Search Criteria" ### # Find the managementpacks which fit the filter documented in $orgmanagementpackname ### $managementpackslist = Get-SCOMManagementPack -ComputerName $ManagementServer |where{$.DisplayName -like "$orgManagementPackName" -and $.
So use this wisely…
This script will use Out-Gridview to prompt the operator for the management pack to disable the alerts for and the override management pack to save those overrides in.
Enjoy! Dan
First, the script to do this for all monitors:
Import-module operationsmanager $SCOMServer = "<SCOMServerName>" New-SCOMManagementGroupConnection -ComputerName $SCOMServer $MPSource = get-scommanagementpack -ComputerName $SCOMServer | where {$.Sealed -eq $True} | Out-GridView -Title "Select a single SOURCE Management Pack" -PassThru $MPOverride = get-scommanagementpack -ComputerName $SCOMServer | where {$.
Another quick one, just to share…. :)
For a HA WAP deployment you will need to update each service of the pertinent url to ensure they are using the NLB endpoint rather than going direct to one of the servers.. This is one that catches a few people out when deploying a HA WAP environment.
Bit’s of the below are scribed from other sources (they escape me right now so apologies for the lack of a references) but found that they didn’t work.
Quick Tip!!
So I was asked to create a custom property that gives a quick overview of the total size for the virtual disks on a VM
So, leveraging of my DataStore script, I came up with the below..
Enjoy Note: This assumes you have created your custom property already
$VMS = Get-scvirtualmachine Foreach ($VM in $VMS) { $DZ = $null $dzprop = Get-SCCustomProperty -Name Datasize $DataSize = Get-SCCustomPropertyValue -CustomProperty $dzprop -InputObject $VM IF ($DataSize.
Edit: added Cloud parameter to the script.
Deploying WAP for clients, they start creating new clouds, plans and subscriptions which is great!! But how do they add existing VM’s to new users in WAP?
Easy….. you guessed it…. PowerShell!
So I can’t take the credit here, my sources are found here & here.
Ok, that’s out of the way.. here it is…
Requirements:
You must have an existing tenant account That tenant must have an existing VM (I usually just kick off a quick VM deployment in WAP and delete it once done) I like to use Out-GridView to keep the script portable.
Had a user try to upload a theme to a Wordpress site they had published using Windows Azure Pack but were getting a file exceeded size limit error as exampled below.
“The uploaded file exceeds the upload_max_filesize directive in php.ini”
Typically you would just go into the php.ini located on the local webserver but how do I do this in a WAP Websites WebFarm?
PowerShell of course!!!
Ok, I do this from the websites controller server:
Another fast publish! (I really should get back and clean these up…)
Recently upgraded one of our Hyper-V clusters and had to migrate workloads to a new Hyper-V cluster.
The naming conventions of our logical switches etc were different so when migrating a VM using Hyper-V manager we were prompted to choose the new logical switch. Handling this via PowerShell in isolation is simple enough using this script but I wanted to do a whole stack of VM’s at once.
Quick scribble: add images and detail
3 steps
Template > NIC > Set Connected > Set static IP & Static MAC > OK
Template > NIC > Set No Connected > Confirm static IP & Static MAC > OK
Template > NIC > Set Connected > VM Network None > Confirm static IP & Static MAC > OK
Do in each template AND hardware profile
Deploying in WAP should work with or without a virtual network.
Just a quick note on how to enable agent proxy via PowerShell
Assumptions in this scenario:
SCOM 2012 R2 - UR3 Using Operations Manager Shell You want all Agents with proxy enabled Some basics:
Get-SCOMAgent
Let’s limit our scope..
Get-SCOMAgent | where {$.ProxyingEnabled -match $False}
Let’s enable the proxy for all listed agents
Get-SCOMAgent | where {$.ProxyingEnabled -match $False} | Enable-SCOMAgentProxy
Check the Agents again..
Get-SCOMAgent | where {$_.ProxyingEnabled -match $False}