Monday 1 December 2014

PowerShell for CaaS 1.2 - Full server and network automation now available.

Happy Holidays!

I am excited to announce PowerShell for Dimension Data CaaS 1.2 has been just released. It means now the we can automate all server and network operations that you will need on end-to-end CaaS deployment. Over the last 3 weeks, I added all the new server, network and VIP (virtual ip address,  load balancing) PowerShell cmdlets to make this happen.


If you haven't done yet, before you start, read my first blog post which details now you can provision servers and change settings in using batch operations.



NOTE: This PowerShell module works for all public and private instances of CaaS.


You can download this release at Github

Details of this release:

1)  No need to remember base API URL for public CaaS. The New-CaasConnection cmdlet now contains 2 additional parameters -Vendor and -Region.

$login=Get-Credential
New-CaasConnection -ApiCredentials $login -Vendor DimensionData -Region Australia_AU


2) Reset CaaS account password. On the CaaS user interface you can only reset your password via email reset password. Use the cmdlet below to reset your Caas password immediately.

$login=Get-Credential
Reset-CaasAccountPassword -ApiCredentials $login -Vendor DimensionData -Region Australia_AU

3) Added additional server operations:
    
Update-CaasServerVMwareTools
New-CaasServerCloneToCustomerImage
Remove-CaasCustomerImage

4) AntiAffinity rules management were also added. 

 
New-CaasServerAntiAffinityRule
Get-CaasServerAntiAffinityRule
Remove-CaasServerAntiAffinityRule
 

5)Added additional network operations
 
Set-CaasNetwork
New-CaasNetworkPublicIpBlock
Get-CaasNetworkPublicIpBlock
Set-CaasNetworkPublicIpBlock
Remove-CaasNetworkPublicIpBlock 


6)Added all VIP operations

New-CaasRealServer
Get-CaasRealServer
Set-CaasRealServer
Remove-CaasRealServer

New-CaasProbe
Get-CaasProbe
Set-CaasProbe
Remove-CaasProbe

New-CaasServerFarm
Get-CaasServerFarm
Get-CaasServerFarmDetails
Set-CaasServerFarm
Remove-CaasServerFarm
Add-CaasToServerFarm
Remove-CaasFromServerFarm

New-CaasPersistenceProfile
Get-CaasPersistenceProfile
Remove-CaasPersistenceProfile

New-CaasVip
Get-CaasVip

Remove-CaasVip 




Here is a sample script that creates a VIP between 2 servers:


$networkname = "Network1"
#this script requires 2 Caas servers to exist: Server1 and Server2

#import Caas Module
Import-Module CaaS

#capture the Caas credentials and create a new Caas conneciton
$login = Get-Credential

New-CaasConnection -ApiCredentials $login -Vendor DimensionData -Region Australia_AU

#Get the network with a specific name
$network=Get-CaasNetworks -Name $networkname

#get server 1
$server1 = Get-CaasDeployedServer -Network $network -Name "Server1"
#get server 2
$server2 = Get-CaasDeployedServer -Network $network -Name "Server2"

#create 2 real servers
$rserver1=New-CaasRealServer -Network $network -Server $server1 -Name $server1.name -InService $true -PassThru

$rserver2=New-CaasRealServer -Network $network -Server $server2 -Name $server2.name -InService $true -PassThru

#create a new probe (optional)
#$probe = New-CaasProbe -Network $network -Name "test" -Type TCP -Port 555
#use a existing probe
$probe = Get-CaasProbe -Network $network -Name "tcp"

$serverfarm = New-CaasServerFarm -Network $network -Name "server1-server2" -Predictor LEAST_CONNECTIONS -RealServer $rserver1 -Probe $probe -PassThru
#add the second server to the server farm
Add-CaasToServerFarm -Network $network -ServerFarm $serverfarm -RealServer $rserver2

#add a probe to the server farm
#Add-CaasToServerFarm -Network $network -ServerFarm $serverfarm -Probe $probe

#create new persistence profile
$persprofile=New-CaasPersistenceProfile -Network $network -Name "PersProfile12" -ServerFarm $serverfarm -TimeoutMinutes 30 -CookieName "DCcookie" -CookieType COOKIE_INSERT -PassThru

#create vip
New-CaasVip -Network $network -Name "Vip12" -PersistenceProfile $persprofile -Port 443 -Protocol TCP -InService $true -ReplyToIcmp $true

#get Vip created
$vip = Get-CaasVip -Network $network -Name "Vip12"

#create an IP Address with vip ipaddress
$vipIpAddress =[IPAddress]$vip.ipAddress

#create ACL rule to permit any connection to the VIP ip address on port 443
New-CaasAclRule -Network $network -AclRuleName "AllowVip444" -Position 202 -Action PERMIT -Protocol TCP -DestinationIpAddress $vipIpAddress -PortRangeType EQUAL_TO -Port1 444

 

Next release plan to add:

- Support to PowerShell -AsJob
- Account operations
- Vendor API