Archive for the ‘Azure’ Tag

How to: Resize virtual machines in #Azure With #Powershell Multiple or Single virtual machines

With the new VM sizes in Azure you may want to change the Size as you get more VM for less money. but remember the VM will restart! so better fi

RDSTWEAKERS.COM

But changing the VM by hand is a time consuming  job So Powershell could be very handy in this case. you can change the Vm size easily with a one-liner

So first we need to login into the azure Subscription.

Login-AzureRmAccount

If you have multiple Subscriptions you need to select the right subscription.

$subscrip=Get-AzureRmSubscription | Out-GridView -OutputMode Single -Title ‘Please select a Azure Subscription.’
Select-AzureRmSubscription -TenantId  $subscrip.TenantId

Get-AzureRmVM

image

 

$vm = Get-AzureRmVM -VMName MVPCB10 -ResourceGroupName RSG-VNET
$vm.HardwareProfile.VmSize = "Standard_D2_v3"
Update-AzureRmVM -VM $vm -ResourceGroupName RSG-VNET

Ok this seems nice but I have 50 VM’s that I like to change

#set new Size to VM
1..5 | % {
$vm = Get-AzureRmVM -ResourceGroupName RSG-VNET -VMName MVPCB1$_
$vm.HardwareProfile.VmSize = "Standard_D13_v2_Promo"
Update-AzureRmVM -VM $vm -ResourceGroupName RSG-VNET

}

Better But if you used random names then the above will not really help you in quick size changing. The next step would be selecting all the VM that needs to be changed and selecting a Size for changing. That sounds great but how to start ?

With the Out-GridView you can do great things. to bad that the price is not available in this.

image

 

The script would be like this :

 

$VMList = Get-AzureRmVm | Out-GridView -OutputMode Multiple -Title ‘Please select an Azure Virtual Machine to resize.’;
$TargetSize = Get-AzureRmVmSize -Location westeurope | Out-GridView -OutputMode Single -Title ‘Please select a target Azure Virtual Machine size.’;
foreach ($VM in $VMList) {
  Write-output "Resizing Microsoft Azure Virtual Machine" $VM.Name "in Resource Group" $VM.ResourceGroupName "to size" $TargetSize
 
  Update-AzureRmVm -VM $VM -ResourceGroupName $VM.ResourceGroupName -Verbose
}
Get-AzureRmVm

After this the VM’s are all changed in a other Size.

Follow Me on Twitter @ClusterMVP

Follow My blog https://robertsmit.wordpress.com

Linkedin Profile Http://nl.linkedin.com/in/robertsmit

Google Me : https://www.google.nl

Bing Me : http://tinyurl.com/j6ny39w

LMGTFY : http://lmgtfy.com/?q=robert+smit+mvp+blog

https://rdstweakers.com

Posted July 18, 2017 by Robert Smit in Azure

Tagged with

#Azure Server Management Tools offers a set of web-GUI #tools to manage #AzureStack Servers #RSMT #ASMT

Azure Server management tools is currently in preview. Any data collected by Server management tools will be stored in the US.!

As this is a preview you can play with this and it is Cool a nice web management. With the Management server you can manage your on premise AzureStack or Deploy a Template with SCVMM. or just turnoff al your domain controllers.  Oh ok I must re-think my security Policy.

As many Azure is External in some cases it is handled just like a server in a DMZ site. So “real dangerous” this is the Cloud directly connected to the WEB.

This DMZ is now turned and be able to manage your internal servers, what is some one has my azure account that has this gateway…. Well I think this is a cool new feature with a lot of new options. In fact I created a cluster in the Azure GUI but it is running on premises.   

Server management tools enables you to remotely manage machines running Windows Server 2016 Technical Preview. Currently, the tools offer the following capabilities:

  • View and change system configuration
  • View performance across various resources and manage processes and services
  • Manage devices attached to the server
  • View event logs
  • View the list of installed roles and features
  • Use a PowerShell console to manage and automate

The Server management tools connection is routed through a Server management tools gateway. When you create a new connection, you will have the opportunity to create a new gateway or select an existing gateway if one already exists in the same resource group. Click on Create to establish a connection to your Windows Server 2016 Technical Preview machine and start exploring the features available today.

Open your Azure management portal and search : Server management tools in the marketplace

image

Select the Server management tools and a new window opens with the network layout on how things are connected.

Image01

So Hit Create

image

The Create option opens a new menu with all kinds of options Name Subscription , Resourcegroup.

image

As this is my first server I create it all Fresh so no connections to other Resource Groups

image

Configuring a new Server management tools Gateway

If you are creating a new gateway, you will see the following status:

image

Click to open the Gateway Configuration page and read carefully and follow the directions to set up your on-premises machine or Azure VM as the gateway.

An Server management tools gateway is required to enable communication between the Microsoft Azure portal and your Windows Server 2016 machine. A gateway is typically deployed and configured on the same local network as the Windows Server machine(s) you wish to manage. The customized gateway deployment package below allows you to install the gateway software on a machine of your choice, and automatically configures the gateway profile to register with your Azure subscription. The deployment package must be run locally on the machine that you want to designate as the Server management tools gateway.

Steps to configure your gateway

image

Save the File on your Windows Server 2016

image

Use the generated link to download the gateway deployment package now, or copy the link URL to download the package later from the machine on which you intend to install the package.

  1. From the machine that you want to designate as the gateway, unzip the package and run GatewayService.MSI.

  2. Once the gateway installation completes, return to the Microsoft Azure portal and reopen your Server management tools connection.

  3. You should now be able to manage your Windows Server 2016 machine if the Microsoft Azure portal can reach it through the gateway.

image

The Extracted File is the installation file with the JSON config file.

A quick setup is needed on the Windows Server 2016.

imageimageimageimage

As you can see there is an extra Services running on the Windows Server 2016

image

When I do a Refresh in the Azure Resource Group.

image

The manage as command is there just go to the Manage As and fill in the server admin account to manage this server

 

image

Fill in the account I us a Local Account as in this scenario I’ll not jumping thru my domain. 

image

You have established a remote connection to your resource and are now able to perform management tasks on it through the Azure Portal.

image

Some errors here with no surprise My local Firewall and Remote management WINRM is not configured as the text below described.

Unable to connect to the server ‘mvpmgt01’: WinRM cannot process the request. The following error with errorcode 0x80090311 occurred while using Kerberos authentication: There are currently no logon servers available to service the logon request. Possible causes are: -The user name or password specified are invalid. -Kerberos is used when no authentication method and no user name are specified. -Kerberos accepts domain user names, but not local user names. -The Service Principal Name (SPN) for the remote computer name and port does not exist. -The client and remote computers are in different domains and there is no trust between the two domains. After checking for the above issues, try the following: -Check the Event Viewer for events related to authentication. -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport. Note that computers in the TrustedHosts list might not be authenticated. -For more information about WinRM configuration, run the following command: winrm help config.

Managing Workgroup machines

In order to manage workgroup machines (e.g. non-domain-joined Nano Servers), run this command as an administrator on the Server management tools gateway machine:

This setting is different than in the guide in Azure

winrm set winrm/config/client’@{TrustedHosts="< NAME OR IP >"}’

When creating a Server management tools connection to the workgroup machine, use the machine’s IP address as the computer name.

Additional connectivity requirements

If you wish to connect using the local Administrator account, you will need to enable this policy on the target machine by running the following command in an administrator session on the target machine:

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1

If you wish to connect to a workgroup machine which is not on the same subnet as the gateway, run the following command in an administrator session on the target machine:

NETSH advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow

Now it is play time

image

image

As you can see you can manage the local server, there are more options like powershell and event viewer but this is not easy to use in the web-GUI

image

 

Happy Stacking

Robert Smit

Twitter: @clustermvp

Cloud and Datacenter MVP

Posted February 12, 2016 by Robert Smit in windows server 2016

Tagged with

PowerShell Place custom VM into Windows Azure Pack Subscription #wapack #cloud #scvmm #Microsoft

During migrations there is always the trouble of all those settings and things to do before everything is running smoothly.

Well during my migration I needed to move several Machines to a private cloud subscription in Azure Pack.

As I’m not the Biggest Powershell Guru I like to keep things simple and I’m a big fan of the “ select Name “  and the  “ Out-GridView “

Options these options give you much more detail and make powershell a but more GUI ( don’t shoot )

#Set your SCVMM server and use -ForOnBehalfOf to make use of Service Provider Foundation.
Import-Module -Name virtualmachinemanager
$VMMSERVER = Get-SCVMMServer -ComputerName YOUR OWN VMM Server-ForOnBehalfOf

#Select WAP Cloud
$Cloud = Get-SCCloud -Name (Get-SCCloud | select Name | Out-GridView -Title "Select WAP Cloud" -PassThru).Name

#Select Select WAP User Subscription
$User = (Get-SCUserRole | Where-Object Cloud -Match $Cloud).Name | Out-GridView -PassThru -Title "Select WAP User Subscription"

# Show WAP Subscription User
$WAPUserrole = Get-SCUserRole | Where-Object Cloud -Match $Cloud | Where-Object Name -Like $User*
$WAPUserrole |ft name

# Select Single VM to WAP
$WAPVM = (Get-SCVirtualMachine ($Cloud | Get-SCVirtualMachine | select Name | Out-GridView -Title "Select Single VM to WAP" -PassThru).Name)

image

 

# show Selected VM to WAP Subscription
$WAPVM|ft name

#Place VM in WAP Subscription
Set-SCVirtualMachine -VM $WAPVM –UserRole $WAPUserrole –Owner $User

As there is a pick list there is no typo there when moving the VM

When Checking the Windows Azure Portal you will see after a refresh a VM that is migrated to Azure Pack.

 

image

Happy clustering

Robert Smit

@clusterMVP

https://robertsmit.wordpress.com

Posted April 14, 2015 by Robert Smit in Azure

Tagged with ,

  • Tag