Vmware Cloud Foundation as Code… Part 1. Importantly! Introduction. The life cycle of an IT solution. Microsoft Visio and Powershell. VMware Cloud Foundation. Architecture as Code. Conceptual Architecture of a SDDC as Code. Bill Of Materials. Brief Summary.

Importantly!


The series of articles “Vmware Cloud Foundation as Code…” is organized and digitized notes from the author’s paper diary. Russian hybrid military aggression and invasion prevented the timely publication of the collected and processed material. The military service of the author, the evacuation of the home mini data center and the blog away from military operations, and later problems with energy supply due to the destruction of the infrastructure by russian missiles, all this forced this activity to be paused.

Now we are all used to and adapted to living in this difficult time and I really want to return to this work.

The publication date of the article in the title is based on the original entries in the author’s diary.

Final revision of this article material: August 11 and 29, 2024.

Introduction


Hello to all readers of the blog about IT Architecture and Education. Author, IT instructor and VMware cloud technology architect Andrii Romanenko returns to active publications after a forced break.

The war radically changed the usual rhythm of life for millions of Ukrainians, including the author of these lines. Civilian life is a thing of the past, as are educational processes and project activities. Some of these activities were compensated by military service.

Over the past time, a lot of various material and ideas have been accumulated for coverage in the form of publications on this blog.

One of the key topics the author has been working on recently is the VMware Cloud Foundation ecosystem. Given the conceptual approach of “Anything as Code…”, I decided to merge these two storylines into one called “Vmware Cloud Foundation as Code…”.

This series of publications aims to reflect the author’s approach to working with the components of the Vmware Cloud Foundation ecosystem versions 4.x, 5.x and the necessary third-party services throughout the life cycle of a cloud solution using code only.

And that is why I would like to remind you to understand the life cycle of any IT solution.

The life cycle of an IT solution


Any IT solution usually goes through several stages during its existence: Design – Architecture and Design; Implementation – Deployment of components, Initial settings, Integration with third-party systems; and Operation – Regulations for Monitoring, Backup, etc.

At each of the stages, specialized specialists operate with various input data, documents, schemes. Various document templates from the vendor are often used to standardize this process, but each of them has its own style and approach in this matter. And a completely monovendor IT solution is a very rare case.

Therefore, I would really like to unify the stages of the life cycle of an IT solution using Code. Based on the Code, form the necessary elements of the architecture and design scheme. Next, based on the Code and the parameters obtained at the previous stage, perform the initial deployment of the system, apply the initial settings, integrate with third-party systems. And in the final version, provide code examples for typical operational tasks.

Well, it is necessary to start these steps from the stage of architecture and design. But first, let’s briefly describe the circuit design tool and the automation and customization framework.

Microsoft Visio and Powershell


Various diagrams are usually used to visualize the architectural principle of system operation. In this context, I mainly use tools in the form of Microsoft Office Visio. For automation tasks – Microsoft Windows Powershell. And here a logical idea arises, and if you combine these two technologies, using Powershell code to create an architectural diagram of an IT solution in Visio format. Why not.

Many years ago, I wrote several Powershell functions that allow you to programmatically create visual diagrams. This script module will be actively used to visualize the various architectural levels of the VMware Cloud Foundation ecosystem and the third-party systems required for its operation.

The code for this script module is given below:

<#
.SYNOPSIS
    Microsoft Powershell functions for operate Visio Drawing

.DESCRIPTION
    Microsoft Powershell functions for drawing Visio objects: Document, Page, Stensil, etc.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  14.09.2007
    Purpose/Change: Initial script development
                    Create function New-VisioApplication.

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Begin Reorganize script.

    Version:        3.3
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  28.06.2023
    Purpose/Change: Reorganize Draw-VisioItem Function. Add parameter LineWeight.

    Version:        3.4
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  22.08.2024
    Purpose/Change: Reorganize Draw-VisioItem Function. Add parameter LineColor.

    Version:        3.5
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  29.08.2024
    Purpose/Change: Added the previously lost function Resize-VisioPageToFitContents.

    Version:        3.6
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  29.08.2024
    Purpose/Change: Added the previously lost function Save-VisioDocument.

    Version:        3.7
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  29.08.2024
    Purpose/Change: Added the previously lost function Close-VisioApplication.

... 
   
.EXAMPLE

    Load Microsoft Powershell functions for operate Visio Drawing: 

    . .\PSVisio.ps1 
#>

# Set Variables
$Shape = 0
$Line = 0
$Icon = 0

Function New-VisioApplication {

<#
.SYNOPSIS
    Microsoft Powershell function for create Visio Application

.DESCRIPTION
    Microsoft Powershell function for create Visio Application.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  14.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Reorganize function
   
.EXAMPLE

    Run:

    New-VisioApplication 
#>

# Create Visio Object
$Script:Application = New-Object -ComObject Visio.Application
$Script:Application.Visible = $True

}

Function New-VisioDocument {

<#
.SYNOPSIS
    Microsoft Powershell function for create Visio Document

.DESCRIPTION
    Microsoft Powershell function for create Visio Document.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  14.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Reorganize function
   
.EXAMPLE

    Run:

    New-VisioDocument 
#>

# Create Document from Blank Template
$Script:Documents = $Script:Application.Documents
$Script:Document = $Script:Application.Documents.Add('')

}

Function Set-VisioPage {

<#
.SYNOPSIS
    Microsoft Powershell function for create Visio Document Page

.DESCRIPTION
    Microsoft Powershell function for create Visio Document Page.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  14.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Reorganize function
   
.EXAMPLE

    Run:

    Set-VisioPage 
#>

# Set Visio Active Page
$Script:Page = $Script:Application.ActivePage
$Script:Application.ActivePage.PageSheet

}

Function Add-VisioStensil  {

<#
.SYNOPSIS
    Microsoft Powershell function for Add Visio Stensil

.DESCRIPTION
    Microsoft Powershell function for Add Visio Stensil.

.PARAMETER Name
    Name Identifier of Visio Stensils.

.PARAMETER File
    Name of Visio Stensils file.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  14.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Reorganize function
   
.EXAMPLE

    Run:

    Add-VisioStensil -Name "Basic" -File "BASIC_M.vss" 
#>

Param ( 
    [Parameter(Mandatory)]
    [string]$Name,
        
    [Parameter(Mandatory)]
    [String]$File         
)

# Set Expression and Add Visio Stensil
$Expression = '$Script:' + $Name + ' = $Script:Application.Documents.Add("' + $File +'")'
Invoke-Expression $Expression

}

Function Set-VisioStensilMasterItem {

<#
.SYNOPSIS
    Microsoft Powershell function for Set Visio Stensil Master Item

.DESCRIPTION
    Microsoft Powershell function for Set Visio Stensil Master Item

.PARAMETER Stensil
    Name Identifier of pre-added Visio Stensils.

.PARAMETER Item
    Reference Name Identifier of Visio Stensils Item .
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  14.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Reorganize function
   
.EXAMPLE

    Run:

    Set-VisioStensilMasterItem -Stensil "Basic" -Item "Rectangle" 
#>

Param ( 
    [Parameter(Mandatory)]
    [string]$Stensil,
        
    [Parameter(Mandatory)]
    [String]$Item     
)

# Set Expression And Set Masters Item Rectangle
$ItemWithoutSpace = $Item -replace " ",""
$Expression = '$Script:' + $ItemWithoutSpace + ' = $Script:' + $Stensil + '.Masters.Item("' + $Item + '")'
Invoke-Expression $Expression

}

Function Draw-VisioItem {

<#
.SYNOPSIS
    Microsoft Powershell function for Draw Visio Item

.DESCRIPTION
    Microsoft Powershell function for Draw Visio Item.

.PARAMETER Master
    Name Identifier of Master Item Visio Stensils.

.PARAMETER X
    X coordinate of Visio Stensils Item.

.PARAMETER Y
    Y coordinate of Visio Stensils Item.

.PARAMETER Width
    Width size of Visio Stensils Item.

.PARAMETER Height
    Height size of Visio Stensils Item.

.PARAMETER FillForegnd
    Foreground color of Visio Stensils Item.

.PARAMETER Fill
    Background color of Visio Stensils Item.

.PARAMETER LinePattern
    Contour line style of Visio Stensils Item.

.PARAMETER LineWeight
    Contour Line thickness size.

.PARAMETER LineColor
    Contour Line Color.

.PARAMETER Text
    Text Visio Stensils Item.

.PARAMETER VerticalAlign
    Vertical Align Visio Stensils Item.

.PARAMETER ParaHorzAlign
    Horizontal Align Visio Stensils Item.

.PARAMETER CharSize
    Text Character Size of Visio Stensils Item.

.PARAMETER CharColor
    Text Character Color of Visio Stensils Item.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  14.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Reorganize function

    Version:        3.3
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  28.06.2023
    Purpose/Change: Reorganize function. Add parameter LineWeight.

    Version:        3.4
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  22.08.2024
    Purpose/Change: Reorganize function. Add parameter LineColor.
   
.EXAMPLE

    Run:

    Draw-VisioItem -Master "Rectangle" -X 6.375 -Y 7.125 -Width 12.2501 -Height 7.25 -FillForegnd "RGB(0,153,204)"`
    -LinePattern 0 -LineWeight "1 pt" -Text "Microsoft Virtual Machine Manager Architecture" -VerticalAlign 0 -ParaHorzAlign 0`
    -CharSize "20 pt" -CharColor "RGB(255,255,255)" -Fill "RGB(255,255,255)" -LineColor "RGB(255,255,255)"
#>

Param ( 
    [Parameter(Mandatory)]
    [string]$Master,
        
    [Parameter(Mandatory)]
    [String]$X,

    [Parameter(Mandatory)]
    [String]$Y,

    [Parameter()]
    [String]$Width,

    [Parameter()]
    [String]$Height,

    [Parameter()]
    [String]$FillForegnd,

    [Parameter()]
    [String]$Fill,

    [Parameter()]
    [String]$LinePattern,

    [Parameter()]
    [String]$LineWeight,

    [Parameter()]
    [String]$LineColor,

    [Parameter()]
    [String]$Text,

    [Parameter()]
    [String]$VerticalAlign,

    [Parameter()]
    [String]$ParaHorzAlign,

    [Parameter()]
    [String]$CharSize,
    
    [Parameter()]
    [String]$CharColor        
)

# Set Variables
$Script:Shape++
$Master = $Master -replace " ",""

# Set Expression And Draw Item
$Expression = '$Script:Shape' + $Script:Shape + ' = $Script:Page.Drop(' + '$' + $Master + ',' + $X + ',' + $Y + ')'
Invoke-Expression $Expression

# Set Item Width Properties
If ($Width)
	{
		$Expression = '$Script:Shape' + $Script:Shape + '.Cells("Width").Formula = ' + $Width
		Invoke-Expression $Expression
	}

# Set Item Height Properties
If ($Height)
	{
		$Expression = '$Script:Shape' + $Script:Shape + '.Cells("Height").Formula = ' + $Height
		Invoke-Expression $Expression
	}

# Set Item FillForegnd Properties
If ($FillForegnd)
	{
		$Expression = '$Script:Shape' + $Script:Shape + '.Cells("FillForegnd").FormulaU = "=' +  $FillForegnd + '"'
		Invoke-Expression $Expression
	}

# Set Item Fill Properties
If ($Fill)
	{
		$Expression = '$Script:Shape' + $Script:Shape + '.CellsU("FillForegnd").FormulaForceU = "' +  $Fill + '"'
		Invoke-Expression $Expression
	}

# Set Item LinePattern Properties
If ($LinePattern)
	{
		$Expression = '$Script:Shape' + $Script:Shape + '.Cells("LinePattern").Formula = ' + $LinePattern
		Invoke-Expression $Expression
	}

# Set Item LineWeight Properties
If ($LineWeight)
	{
		$Expression = '$Script:Shape' + $Script:Shape + '.Cells("LineWeight").Formula = "' + $LineWeight + '"'
		Invoke-Expression $Expression
	}

# Set Item Line Color Properties
If ($LineColor)
	{
        $Expression = '$Script:Shape' + $Script:Shape + '.Cells("LineColor").FormulaU = "=' +  $LineColor + '"'
		Invoke-Expression $Expression
	}

# Set Item Text
If ($Text)
	{
		$Expression = '$Script:Shape' + $Script:Shape + '.Text = "' + $Text + '"'
		Invoke-Expression $Expression
	}

# Set Item VerticalAlign Properties
If ($VerticalAlign)
	{
		$Expression = '$Script:Shape' + $Script:Shape + '.Cells("VerticalAlign").Formula = ' + $VerticalAlign
		Invoke-Expression $Expression
	}

# Set Item HorzAlign Properties
If ($ParaHorzAlign)
	{
		$Expression = '$Script:Shape' + $Script:Shape + '.Cells("Para.HorzAlign").Formula = ' + $ParaHorzAlign
		Invoke-Expression $Expression
	}

# Set Item Char.Size Properties
If ($CharSize)
	{
		$Expression = '$Script:Shape' + $Script:Shape + '.Cells("Char.Size").Formula = "' + $CharSize + '"'
		Invoke-Expression $Expression
	}

# Set Item Char.Color Properties
If ($CharColor)
	{
		$Expression = '$Script:Shape' + $Script:Shape + '.Cells("Char.Color").FormulaU = "=' +  $CharColor + '"'
		Invoke-Expression $Expression
	}
}

Function Draw-VisioLine {

<#
.SYNOPSIS
    Microsoft Powershell function for Draw Visio Line

.DESCRIPTION
    Microsoft Powershell function for Draw Visio Line.

.PARAMETER BeginX
    Begin X coordinate of Visio Line.

.PARAMETER BeginY
    Begin Y coordinate of Visio Line.

.PARAMETER EndX
    End X coordinate of Visio Line.

.PARAMETER EndY
    End X coordinate of Visio Line.

.PARAMETER LineWeight
    Visio Line thickness size.

.PARAMETER LineColor
    Visio Line Color.
    
.PARAMETER BeginArrow
    Begin Arrow Visio Line Style.

.PARAMETER EndArrow
    End Arrow Visio Line Style.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  15.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Reorganize function
   
.EXAMPLE

    Run:

    Draw-VisioLine -BeginX 0.3125 -BeginY 10.3438 -EndX 12.4948 -EndY 10.3438 -LineWeight "1 pt"`
    -LineColor "RGB(255,255,255)" -BeginArrow 4 -EndArrow 4 
#>

Param ( 
    [Parameter(Mandatory)]
    [string]$BeginX,
        
    [Parameter(Mandatory)]
    [String]$BeginY,

    [Parameter(Mandatory)]
    [String]$EndX,

    [Parameter(Mandatory)]
    [String]$EndY,

    [Parameter()]
    [String]$LineWeight,

    [Parameter()]
    [String]$LineColor,

    [Parameter()]
    [String]$BeginArrow,

    [Parameter()]
    [String]$EndArrow      
)

# Set variable
$Script:Line++

# Set Expression And Draw Line
$Expression = '$Script:Line' + $Script:Line + ' = $Script:Page.DrawLine(' + $BeginX + ',' + $BeginY + ',' + $EndX + ',' + $EndY + ')'
Invoke-Expression $Expression

# Set Line Width Properties
If ($LineWeight)
	{
		$Expression = '$Script:Line' + $Script:Line + '.Cells("LineWeight").Formula = "' + $LineWeight + '"'
		Invoke-Expression $Expression
	}

# Set Line Color Properties
$Expression = '$Script:Line' + $Script:Line + '.Cells("LineColor").FormulaU = "=' +  $LineColor + '"'
Invoke-Expression $Expression

# Set Line Begin Arrow Properties
If ($BeginArrow)
	{
		$Expression = '$Script:Line' + $Script:Line + '.Cells("BeginArrow").Formula = ' + $BeginArrow
		Invoke-Expression $Expression
	}

# Set Line End Arrow Properties
If ($EndArrow)
	{
		$Expression = '$Script:Line' + $Script:Line + '.Cells("EndArrow").Formula = ' + $EndArrow
		Invoke-Expression $Expression
	}
}

Function Draw-VisioIcon {

<#
.SYNOPSIS
    Microsoft Powershell function for Draw Visio Icon

.DESCRIPTION
    Microsoft Powershell function for Draw Visio Icon.

.PARAMETER IconPath
    Path to load icon.

.PARAMETER Width
    Width size of Visio Icon.

.PARAMETER Height
    Height size of Visio Icon.

.PARAMETER PinX
    X coordinates of Visio Icon.

.PARAMETER PinY
    Y Coordinates of Visio Icon.

.PARAMETER Text
    Text Visio Icon.

.PARAMETER CharSize
    Text Character Size of Visio Icon.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  16.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  02.09.2022
    Purpose/Change: Reorganize function
   
.EXAMPLE

    Run:

    Draw-VisioIcon -IconPath "c:\!\powershell.png" -Width 0.9843 -Height 0.9843 -PinX 2.5547 -PinY 9.2682`
    -Text "Windows Powershell" -CharSize "10 pt"
#>

Param ( 
    [Parameter(Mandatory)]
    [string]$IconPath,

    [Parameter(Mandatory)]
    [String]$Width,

    [Parameter(Mandatory)]
    [String]$Height,

    [Parameter()]
    [String]$PinX,

    [Parameter()]
    [String]$PinY,

    [Parameter()]
    [String]$Text,

    [Parameter()]
    [String]$CharSize
)

# Set Variables
$Script:Icon++

# Import Icon Item
$Expression = '$Script:Icon' + $Script:Icon + ' = $Script:Page.Import("' + $IconPath + '")'
Invoke-Expression $Expression

# Set Icon Width Properties
$Expression = '$Script:Icon' + $Script:Icon + '.Cells("Width").Formula = ' + $Width
Invoke-Expression $Expression

# Set Icon Height Properties
$Expression = '$Script:Icon' + $Script:Icon + '.Cells("Height").Formula = ' + $Height
Invoke-Expression $Expression

# Set Icon PinX Properties
$Expression = '$Script:Icon' + $Script:Icon + '.Cells("PinX").Formula = ' + $PinX
Invoke-Expression $Expression

# Set Icon PinY Properties
$Expression = '$Script:Icon' + $Script:Icon + '.Cells("PinY").Formula = ' + $PinY
Invoke-Expression $Expression

# Set Icon Text
If ($Text)
	{
		$Expression = '$Script:Icon' + $Script:Icon + '.Text = "' + $Text + '"'
		Invoke-Expression $Expression
	}

# Set Icon Char.Size Properties
If ($CharSize)
	{
		$Expression = '$Script:Icon' + $Script:Icon + '.Cells("Char.Size").Formula = "' + $CharSize + '"'
		Invoke-Expression $Expression
	}
}

Function Draw-VisioText {

<#
.SYNOPSIS
    Microsoft Powershell function for Draw Visio Text

.DESCRIPTION
    Microsoft Powershell function for Draw Visio Text.

.PARAMETER BeginX
    Begin X coordinate of Visio Text.

.PARAMETER BeginY
    Begin Y coordinate of Visio Text.

.PARAMETER Width
    Width size of Visio Text.

.PARAMETER Height
    Height size of Visio Text.

.PARAMETER FillForegnd
    Background color of Visio Text.

.PARAMETER LinePattern
    Contour line style of Visio Text.

.PARAMETER Text
    Text Visio Item.

.PARAMETER VerticalAlign
    Vertical Align Visio Text.

.PARAMETER ParaHorzAlign
    Horizontal Align Visio Text.

.PARAMETER CharSize
    Text Character Size of Visio Text.

.PARAMETER CharColor
    Text Character Color of Visio Text.

.PARAMETER CharStyle
    Text Character Style of Visio Text.

.PARAMETER FillForegndTrans
    Transparent Fill Value of Visio Text.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  15.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  02.09.2022
    Purpose/Change: Reorganize function
   
.EXAMPLE

    Run:

    Draw-VisioText -X 4.25 -Y 8.875 -Width 1.3751 -Height 0.375 -Text "Deploy Admin / Dev" -CharSize "10 pt" -CharStyle 17 -LinePattern "0" -FillForegndTrans "100%"
#>

Param ( 
    [Parameter(Mandatory)]
    [string]$X,
        
    [Parameter(Mandatory)]
    [String]$Y,

    [Parameter(Mandatory)]
    [String]$Width,

    [Parameter(Mandatory)]
    [String]$Height,

    [Parameter()]
    [String]$FillForegnd,

    [Parameter()]
    [String]$LinePattern,

    [Parameter()]
    [String]$Text,

    [Parameter()]
    [String]$VerticalAlign,

    [Parameter()]
    [String]$ParaHorzAlign,

    [Parameter()]
    [String]$CharSize,

    [Parameter()]
    [String]$CharColor,

    [Parameter()]
    [String]$CharStyle,

    [Parameter()]
    [String]$FillForegndTrans
)

# Set Variables
$Script:Text++
$Master = "Rectangle"

# Set Expression And Draw Text
$Expression = '$Script:Text' + $Script:Text + ' = $Script:Page.Drop(' + '$' + $Master + ',' + $X + ',' + $Y + ')'
Invoke-Expression $Expression

# Set Item Width Properties
If ($Width)
	{
		$Expression = '$Script:Text' + $Script:Text + '.Cells("Width").Formula = ' + $Width
		Invoke-Expression $Expression
	}

# Set Item Height Properties
If ($Height)
	{
		$Expression = '$Script:Text' + $Script:Text + '.Cells("Height").Formula = ' + $Height
		Invoke-Expression $Expression
	}

# Set Item FillForegnd Properties
If ($FillForegnd)
	{
		$Expression = '$Script:Text' + $Script:Text + '.Cells("FillForegnd").Formula = "=' +  $FillForegnd + '"'
		Invoke-Expression $Expression
	}

# Set Item LinePattern Properties
If ($LinePattern)
	{
		$Expression = '$Script:Text' + $Script:Text + '.Cells("LinePattern").Formula = ' + $LinePattern
		Invoke-Expression $Expression
	}

# Set Item Text
If ($Text)
	{
		$Expression = '$Script:Text' + $Script:Text + '.Text = "' + $Text + '"'
		Invoke-Expression $Expression
	}

# Set Item VerticalAlign Properties
If ($VerticalAlign)
	{
		$Expression = '$Script:Text' + $Script:Text + '.Cells("VerticalAlign").Formula = ' + $VerticalAlign
		Invoke-Expression $Expression
	}

# Set Item HorzAlign Properties
If ($ParaHorzAlign)
	{
		$Expression = '$Script:Text' + $Script:Text + '.Cells("Para.HorzAlign").Formula = ' + $ParaHorzAlign
		Invoke-Expression $Expression
	}

# Set Item Char.Size Properties
If ($CharSize)
	{
		$Expression = '$Script:Text' + $Script:Text + '.Cells("Char.Size").Formula = "' + $CharSize + '"'
		Invoke-Expression $Expression
	}

# Set Item Char.Color Properties
If ($CharColor)
	{
		$Expression = '$Script:Text' + $Script:Text + '.Cells("Char.Color").FormulaU = "=' +  $CharColor + '"'
		Invoke-Expression $Expression
	}

# Set Item Char.Style Properties
If ($CharStyle)
	{
		$Expression = '$Script:Text' + $Script:Text + '.Cells("Char.Style").Formula = "' + $CharStyle + '"'
		Invoke-Expression $Expression
	}
	
# Set Item FillForegndTrans Properties
If ($FillForegndTrans)
	{
		$Expression = '$Script:Text' + $Script:Text + '.Cells("FillForegndTrans").Formula = "' + $FillForegndTrans + '"'
		Invoke-Expression $Expression
	}		
}

Function Draw-VisioPolyLine {

<#
.SYNOPSIS
    Microsoft Powershell function for Draw Visio PolyLine

.DESCRIPTION
    Microsoft Powershell function for Draw Visio PolyLine.

.PARAMETER Polyline
   Polyline coordinates of Visio PolyLine.

.PARAMETER LineWeight
    Visio Line thickness size.

.PARAMETER LineColor
    Visio Line Color.
    
.PARAMETER BeginArrow
    Begin Arrow Visio Line Style.

.PARAMETER EndArrow
    End Arrow Visio Line Style.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  18.09.2007
    Purpose/Change: Initial script development

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Reorganize function
   
.EXAMPLE

    Run:

    Draw-VisioPolyLine -Polyline 1.0938,9.0625,1.4063,9.0625,1.4063,8.6563,1.0938,8.6563 -LineWeight "0.5 pt"`
    -LineColor "RGB(255,255,255)" -BeginArrow 1 -EndArrow 1
#>

Param ( 
    [Parameter(Mandatory)]
    [array]$Polyline,

    [Parameter()]
    [String]$LineWeight,

    [Parameter()]
    [String]$LineColor,

    [Parameter()]
    [String]$BeginArrow,

    [Parameter()]
    [String]$EndArrow      
)

# Set  Variable
$Script:PolyLine++
[double[]]$PolyLineCoordinates=@()
$PolyLineCoordinates += $Polyline

# Set Expression And Draw PolyLine
$Expression = '$Script:PolyLine' + $Script:PolyLine + ' = $Script:Page.DrawPolyLine([ref]($PolyLineCoordinates),0)'
Invoke-Expression $Expression

# Set Line Width Properties
If ($LineWeight)
	{
		$Expression = '$Script:PolyLine' + $Script:PolyLine + '.Cells("LineWeight").Formula = "' + $LineWeight + '"'
		Invoke-Expression $Expression
	}

# Set Line Color Properties
$Expression = '$Script:PolyLine' + $Script:PolyLine + '.Cells("LineColor").FormulaU = "=' +  $LineColor + '"'
Invoke-Expression $Expression

# Set Line Begin Arrow Properties
If ($BeginArrow)
	{
		$Expression = '$Script:PolyLine' + $Script:PolyLine + '.Cells("BeginArrow").Formula = ' + $BeginArrow
		Invoke-Expression $Expression
	}

# Set Line End Arrow Properties
If ($EndArrow)
	{
		$Expression = '$Script:PolyLine' + $Script:PolyLine + '.Cells("EndArrow").Formula = ' + $EndArrow
		Invoke-Expression $Expression
	}
}

Function Resize-VisioPageToFitContents {
<#
.SYNOPSIS
    Microsoft Powershell function for Resize Active Visio Document Page to Fit Contents.

.DESCRIPTION
    Microsoft Powershell function for Resize Active Visio Document Page to Fit Contents.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  17.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Reorganize function.
   
.EXAMPLE

    Run:

    Resize-VisioPageToFitContents 
#>

# Resize Page to Fit Contents
$Script:Page.ResizeToFitContents()

}

Function Save-VisioDocument {
<#
.SYNOPSIS
    Microsoft Powershell function for save Visio Document.

.DESCRIPTION
    Microsoft Powershell function for save Visio Document.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  17.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Reorganize function.
   
.EXAMPLE

    Run:

    Save-VisioDocument -File 'C:\!\Diagram.vsd' 
#>

Param ( 
    [Parameter(Mandatory)]
    [String]$File
)

# Save Document
$Expression = '$Script:Document.SaveAs("' + $File + '")'
Invoke-Expression $Expression

}

Function Close-VisioApplication {
<#
.SYNOPSIS
    Microsoft Powershell function for Close Visio Application.

.DESCRIPTION
    Microsoft Powershell function for Close Visio Application.
  
.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  17.09.2007
    Purpose/Change: Initial script development

...

    Version:        3.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  01.09.2022
    Purpose/Change: Reorganize function.
   
.EXAMPLE

    Run:

    Close-VisioApplication 
#>

# Close Visio Application
$Script:Application.Quit()

}

Since the creation of the module in 2007 and until today, the code has hardly changed, only cosmetic changes have been made. You are free to use any fragments of this code in your activity.

The current version of the code is available on the GitHub resource at this link: PSVisio.ps1

Next, we will try to apply these developments to display the various architectural levels of the VMware Cloud Foundation ecosystem.

VMware Cloud Foundation. Architecture as Code.


The ecosystem of VMware Cloud Foundation services is mature and quite complex. Therefore, to facilitate understanding of their interaction and the correct sequence of actions during design, implementation and operation, the vendor has prepared a set of accompanying documents: VMware Cloud Foundation Documentation 4.x (Archive file name – vcf-40-doc.zip), VMware Validated Design 6.0 (Archive file name – vmware-validated-design-60x.zip) and Diagrams for VMware Validated Design (Archive file name – vvd-diagrams -release-6.0.0.zip).

It is these priceless digital artifacts that will help us demonstrate the progress of the storyline stage “VMware Cloud Foundation. Architecture as Code“.

Based on our own approach and experience step by step, we will try to work out all levels from architecture and design to operation everywhere through the prism of code.

Conceptual Architecture of a SDDC as Code


Let’s start with the first step: creating a visual diagram Conceptual Architecture of a Software-Defined Data Center using code. In the above-mentioned bundles of documentation, it looks approximately like this:

Figure 1: The result of visualization of the Conceptual Architecture of a Software-Defined Data Center using Powershell code and Microsoft Visio.

PowerShell code for building such a diagram:

# Step 1.
# Set Global Variables
$VCFasCodeHomeFolder = "D:\VCFasCode" # Folder for VCF as Code scripts and others artefacts.

# Step 2.
# Load Script Functions
Set-Location $VCFasCodeHomeFolder
. .\PSVisio.ps1 # Warning! Running scripts must be enabled on your system.

# Step 3.
# Create Visio Application
# Create Document from Blank Template
# Set Active Page
New-VisioApplication
New-VisioDocument
Set-VisioPage

# Step 4.
# Add Basic Visio Stensils
# Set Masters Item Rectangle
Add-VisioStensil -Name "Basic" -File "BASIC_M.vss"
Set-VisioStensilMasterItem -Stensil "Basic" -Item "Rectangle"

# Step 5.
# Set VMware Items Visio Stensils File Path
# Add VMware Items Visio Stensils
# Set Masters item Public Cloud, vRealize Automation, vRealize Orchestrator, VM Server, Resource Pool, vCenter Server,
# Set Masters item Rack Server, Datastore, Physical NIC
# Set Masters item Calendar
# Set Masters item vRealize Operations, vRealize log Insight, VMware Cloud Solution
# Set Masters item vCloud Availability, Site Recovery, Data Protection, Replication
# Set Masters item Secure State, Identity, Book, License
$StensilFilePath = $VCFasCodeHomeFolder + "\" + "vmw_Icons.vssx"
Add-VisioStensil -Name "VMware" -File $StensilFilePath 
Set-VisioStensilMasterItem -Stensil "VMware" -Item "Public Cloud"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "vRealize Automation"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "vRealize Orchestrator"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "VM Server"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "Resource Pool"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "vCenter Server"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "Rack Server"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "Datastore"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "Physical NIC"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "Calendar"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "vRealize Operations"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "vRealize log Insight"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "VMware Cloud Solution"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "vCloud Availability"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "Site Recovery"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "Data Protection"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "VR"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "Secure State"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "Identity"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "Book"
Set-VisioStensilMasterItem -Stensil "VMware" -Item "License"
$StensilFilePath = $VCFasCodeHomeFolder + "\" + "VMware_vCenter_Orchestrator_Shapes.vssx"
Add-VisioStensil -Name "VMwareVCO" -File $StensilFilePath 
Set-VisioStensilMasterItem -Stensil "VMwareVCO" -Item "OK"

# Step 6.
# Draw Main Rectangle, Set Size, Set Colour
# Set Header Text, Size, Color, Align
# Draw Line, Set Weight, Color
Draw-VisioItem -Master "Rectangle" -X 7.3125 -Y 7.2733 -Width 14.125 -Height 7.0467 -FillForegnd "RGB(255,255,255)" `
 -LinePattern 0 -Text "Software Defined Data Center Conceptual Diagram" -VerticalAlign 0 -ParaHorzAlign 0 `
 -CharSize "30 pt" -CharColor "RGB(0,112,192)"
Draw-VisioLine -BeginX 0.25 -BeginY 10.2294 -EndX 14.25 -EndY 10.2294 -LineWeight "1 pt" -LineColor "RGB(0,112,192)"

# Step 7. 
# Draw Cloud Automation Rectangle, Set Size, Set Colour
# Draw Text, Set Size, Color
# Draw Public Cloud, vRealize Automation, vRealize Orchestrator Icons Background Rectangle, Set Size, Set Colour
# Draw Icon Public Cloud, vRealize Automation, vRealize Orchestrator
# Draw Service Catalog Rectangle, Set Size, Set Colour, Set Line Weight
# Draw Self-Service Portal Rectangle, Set Size, Set Colour, Set Line Weight
# Draw Orchestration Rectangle, Set Size, Set Colour, Set Line Weight
Draw-VisioItem -Master "Rectangle" -X 2.8675 -Y 9.0947 -Width 5.2344 -Height 1.9801 -FillForegnd "RGB(152,203,225)" -LinePattern 0 
Draw-VisioText -X 1.1043 -Y 9.7391 -Width 1.7085 -Height 0.6912 -Text "Cloud Automation" -CharSize "18 pt" -CharStyle 17 -LinePattern "0" -FillForegndTrans "100%"
Draw-VisioItem -Master "Rectangle" -X 1.125 -Y 8.8089 -Width 1.5 -Height 1.1804 -FillForegnd "RGB(255,255,255)" -LinePattern 0 
Draw-VisioItem -Master "Public Cloud" -X 1.1043 -Y 9.0473 -Width 0.5612 -Height 0.5612
Draw-VisioItem -Master "vRealize Automation" -X 0.7436 -Y 8.5256 -Width 0.4531 -Height 0.4531
Draw-VisioItem -Master "vRealize Orchestrator" -X 1.3621 -Y 8.5256 -Width 0.4531 -Height 0.4531
Draw-VisioItem -Master "Rectangle" -X 3.6749 -Y 9.7286 -Width 3.3828 -Height 0.5174 -FillForegnd "RGB(152,203,225)" `
 -Text "Service Catalog" -VerticalAlign 1 -ParaHorzAlign 1 `
 -CharSize "18 pt" -LinePattern 1 -LineWeight "1 pt"
Draw-VisioItem -Master "Rectangle" -X 3.6749 -Y 9.1083 -Width 3.3828 -Height 0.5174 -FillForegnd "RGB(152,203,225)" `
 -Text "Self-Service Portal" -VerticalAlign 1 -ParaHorzAlign 1 `
 -CharSize "18 pt" -LinePattern 1 -LineWeight "1 pt"
Draw-VisioItem -Master "Rectangle" -X 3.6749 -Y 8.4769 -Width 3.3828 -Height 0.5174 -FillForegnd "RGB(152,203,225)" `
 -Text "Orchestration" -VerticalAlign 1 -ParaHorzAlign 1 `
 -CharSize "18 pt" -LinePattern 1 -LineWeight "1 pt"

# Step 8.  
# Draw Virtual Infrastructure Rectangle, Set Size, Set Colour
# Draw Text, Set Size, Color
# Draw VM Server, Resource Pool, vCenter Server Icons Background Rectangle, Set Size, Set Colour
# Draw Icon VM Server, Resource Pool, vCenter Server
# Draw Hypervisor Rectangle, Set Size, Set Colour, Set Line Weight
# Draw Pools of Resources Rectangle, Set Size, Set Colour, Set Line Weight
# Draw Virtualization Control Rectangle, Set Size, Set Colour, Set Line Weight
Draw-VisioItem -Master "Rectangle" -X 2.8675 -Y 6.9564 -Width 5.2344 -Height 1.9801 -FillForegnd "RGB(58,158,207)" -LinePattern 0 
Draw-VisioText -X 1.1043 -Y 7.6008 -Width 1.7085 -Height 0.6912 -Text "Virtual Infrastructure" -CharSize "18 pt" -CharStyle 17 -CharColor "RGB(255,255,255)" -LinePattern "0" -FillForegndTrans "100%"
Draw-VisioItem -Master "Rectangle" -X 1.125 -Y 6.6648 -Width 1.5 -Height 1.1804 -FillForegnd "RGB(255,255,255)" -LinePattern 0 
Draw-VisioItem -Master "VM Server" -X 1.1043 -Y 6.9285 -Width 0.5612 -Height 0.5612
Draw-VisioItem -Master "Resource Pool" -X 0.7436 -Y 6.3565 -Width 0.4531 -Height 0.4531
Draw-VisioItem -Master "vCenter Server" -X 1.3621 -Y 6.3565 -Width 0.4531 -Height 0.4531
Draw-VisioItem -Master "Rectangle" -X 3.6748 -Y 7.5903 -Width 3.3828 -Height 0.5174 -FillForegnd "RGB(58,158,207)" `
 -Text "Hypervisor" -VerticalAlign 1 -ParaHorzAlign 1 `
 -CharSize "18 pt" -LinePattern 1 -LineWeight "1 pt" -CharColor "RGB(255,255,255)" -LineColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 3.6748 -Y 6.97 -Width 3.3828 -Height 0.5174 -FillForegnd "RGB(58,158,207)" `
 -Text "Pools of Resources" -VerticalAlign 1 -ParaHorzAlign 1 `
 -CharSize "18 pt" -LinePattern 1 -LineWeight "1 pt" -CharColor "RGB(255,255,255)" -LineColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 3.6748 -Y 6.3386 -Width 3.3828 -Height 0.5174 -FillForegnd "RGB(58,158,207)" `
 -Text "Virtualization Control" -VerticalAlign 1 -ParaHorzAlign 1 `
 -CharSize "18 pt" -LinePattern 1 -LineWeight "1 pt" -CharColor "RGB(255,255,255)" -LineColor "RGB(255,255,255)"

# Step 9.
# Draw Physical Infrastructure Rectangle, Set Size, Set Colour
# Draw Text, Set Size, Color
# Draw Rack Server, Datastore, Physical NIC Icons Background Rectangle, Set Size, Set Colour
# Draw Icon Rack Server, Datastore, Physical NIC
# Draw Compute Rectangle, Set Size, Set Colour, Set Line Weight
# Draw Storage Rectangle, Set Size, Set Colour, Set Line Weight
# Draw Network Rectangle, Set Size, Set Colour, Set Line Weight
Draw-VisioItem -Master "Rectangle" -X 2.8625 -Y 4.8378 -Width 5.2344 -Height 1.9801 -FillForegnd "RGB(0,105,143)" -LinePattern 0 
Draw-VisioText -X 1.1043 -Y 5.4822 -Width 1.7085 -Height 0.6912 -Text "Physical Infrastructure" -CharSize "18 pt" -CharStyle 17 -CharColor "RGB(255,255,255)" -LinePattern "0" -FillForegndTrans "100%"
Draw-VisioItem -Master "Rectangle" -X 1.125 -Y 4.5462 -Width 1.5 -Height 1.1804 -FillForegnd "RGB(255,255,255)" -LinePattern 0
Draw-VisioItem -Master "Rack Server" -X 0.8125 -Y 4.8583 -Width 0.5612 -Height 0.1837
Draw-VisioItem -Master "Rack Server" -X 1.4694 -Y 4.8583 -Width 0.5612 -Height 0.1837
Draw-VisioItem -Master "Datastore" -X 0.789 -Y 4.375 -Width 0.4531 -Height 0.4531
Draw-VisioItem -Master "Physical NIC" -X 1.4375 -Y 4.375 -Width 0.4531 -Height 0.4531
Draw-VisioItem -Master "Rectangle" -X 3.6748 -Y 5.4717 -Width 3.3828 -Height 0.5174 -FillForegnd "RGB(0,105,143)" `
 -Text "Compute" -VerticalAlign 1 -ParaHorzAlign 1 `
 -CharSize "18 pt" -LinePattern 1 -LineWeight "1 pt" -CharColor "RGB(255,255,255)" -LineColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 3.6748 -Y 4.8514 -Width 3.3828 -Height 0.5174 -FillForegnd "RGB(0,105,143)" `
 -Text "Storage" -VerticalAlign 1 -ParaHorzAlign 1 `
 -CharSize "18 pt" -LinePattern 1 -LineWeight "1 pt" -CharColor "RGB(255,255,255)" -LineColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 3.6748 -Y 4.22 -Width 3.3828 -Height 0.5174 -FillForegnd "RGB(0,105,143)" `
 -Text "Network" -VerticalAlign 1 -ParaHorzAlign 1 `
 -CharSize "18 pt" -LinePattern 1 -LineWeight "1 pt" -CharColor "RGB(255,255,255)" -LineColor "RGB(255,255,255)"

# Step 10.
# Draw Cloud Operations Rectangle, Set Size, Set Colour
# Draw Text, Set Size, Color, Align
# Icon Calendar, OK Background Rectangle, Set Size, Set Colour
# Draw Icon Calendar, OK
# Draw Monitoring Rectangle, Set Size, Set Colour, Set Line Weight
# Icon Monitoring Background Rectangle, Set Size, Set Colour
# Draw Icon Monitoring
# Draw Text, Set Size, Color
# Draw Logging Rectangle, Set Size, Set Colour, Set Line Weight
# Icon Site Recovery Background Rectangle, Set Size, Set Colour
# Draw Icon Logging
# Draw Text, Set Size, Color
# Draw Life Cycle management Rectangle, Set Size, Set Colour, Set Line Weight
# Icon Public Cloud Background Rectangle, Set Size, Set Colour
# Draw Icon Public Cloud
# Draw Masking Rectangle, Set Size, Set Colour, Set Line Weight
# Draw Icon VMware Cloud Solution
# Draw Text, Set Size, Color
Draw-VisioItem -Master "Rectangle" -X 6.9729 -Y 6.9684 -Width 2.7531 -Height 6.2451 -FillForegnd "RGB(226,232,241)" -LinePattern 0 
Draw-VisioText -X 6.9859 -Y 9.7286 -Width 1.9719 -Height 0.2878 -Text "Cloud Operations" -CharSize "18 pt" -CharStyle 17 -LinePattern "0" -FillForegndTrans "100%"
Draw-VisioItem -Master "Rectangle" -X 6.9674 -Y 8.6529 -Width 2.5312 -Height 1.1808 -FillForegnd "RGB(255,255,255)" -LinePattern 0 
Draw-VisioItem -Master "Calendar" -X 6.9688 -Y 8.7695 -Width 0.9375 -Height 0.8359 
Draw-VisioItem -Master "OK" -X 7.4375 -Y 8.375 -Width 0.4363 -Height 0.4363
Draw-VisioItem -Master "Rectangle" -X 6.97 -Y 7.3064 -Width 2.5312 -Height 1.0825 -FillForegnd "RGB(226,232,241)" `
  -LinePattern 1 -LineWeight "1 pt"
Draw-VisioItem -Master "Rectangle" -X 6.1352 -Y 7.3064 -Width 0.5937 -Height 0.5937 -FillForegnd "RGB(255,255,255)" `
  -LinePattern 0
Draw-VisioItem -Master "vRealize Operations" -X 6.1333 -Y 7.3064 -Width 0.4708 -Height 0.4708
Draw-VisioText -X 7.2812 -Y 7.3064 -Width 1.3725 -Height 0.2878 -Text "Monitoring" -CharSize "18 pt" -LinePattern "0" -FillForegndTrans "100%"
Draw-VisioItem -Master "Rectangle" -X 6.97 -Y 5.8955 -Width 2.5312 -Height 1.0825 -FillForegnd "RGB(226,232,241)" `
  -LinePattern 1 -LineWeight "1 pt"
Draw-VisioItem -Master "Rectangle" -X 6.1352 -Y 5.8955 -Width 0.5937 -Height 0.5937 -FillForegnd "RGB(255,255,255)" `
  -LinePattern 0
Draw-VisioItem -Master "vRealize log Insight" -X 6.1333 -Y 5.8788 -Width 0.4708 -Height 0.5102
Draw-VisioText -X 7.2812 -Y 5.8955 -Width 1.3725 -Height 0.2878 -Text "Logging" -CharSize "18 pt" -LinePattern "0" -FillForegndTrans "100%"
Draw-VisioItem -Master "Rectangle" -X 6.97 -Y 4.4952 -Width 2.5312 -Height 1.0825 -FillForegnd "RGB(226,232,241)" `
  -LinePattern 1 -LineWeight "1 pt"
Draw-VisioItem -Master "Rectangle" -X 6.1352 -Y 4.524 -Width 0.5937 -Height 0.5937 -FillForegnd "RGB(255,255,255)" `
  -LinePattern 0
Draw-VisioItem -Master "Public Cloud" -X 6.1347 -Y 4.5453 -Width 0.5431 -Height 0.5102
Draw-VisioItem -Master "Rectangle" -X 6.1438 -Y 4.3984 -Width 0.3682 -Height 0.0781 -FillForegnd "RGB(255,255,255)" `
  -LinePattern 0
Draw-VisioItem -Master "VMware Cloud Solution" -X 6.1408 -Y 4.4053 -Width 0.3214 -Height 0.3105
Draw-VisioText -X 7.2969 -Y 4.5227 -Width 1.7813 -Height 0.5102 -Text "Life Cycle Management" -CharSize "18 pt" -LinePattern "0" -FillForegndTrans "100%"

# Step 11.
# Draw Business Continuity Rectangle, Set Size, Set Colour
# Draw Text, Set Size, Color
# Icon vCloud Availability Background Rectangle, Set Size, Set Colour
# Draw Icon vCloud Availability
# Draw Fault Tolerance & Disaster Recovery Rectangle, Set Size, Set Colour, Set Line Weight
# Icon Site Recovery Background Rectangle, Set Size, Set Colour
# Draw Icon Site Recovery
# Draw Text, Set Size, Color
# Draw Backup & Restore Rectangle, Set Size, Set Colour, Set Line Weight
# Icon Data Protection Background Rectangle, Set Size, Set Colour
# Draw Icon Data Protection
# Draw Text, Set Size, Color
# Draw Replication Rectangle, Set Size, Set Colour, Set Line Weight
# Icon Replication Background Rectangle, Set Size, Set Colour
# Draw Icon Replication
# Draw Text, Set Size, Color
Draw-VisioItem -Master "Rectangle" -X 9.9231 -Y 6.9741 -Width 2.7531 -Height 6.2451 -FillForegnd "RGB(29,62,125)" -LinePattern 0 
Draw-VisioText -X 9.8831 -Y 9.7286 -Width 1.2663 -Height 0.5174 -Text "Business Continuity" -CharSize "18 pt" -CharStyle 17 -CharColor "RGB(255,255,255)" -LinePattern "0" -FillForegndTrans "100%"
Draw-VisioItem -Master "Rectangle" -X 9.9208 -Y 8.6529 -Width 2.5312 -Height 1.1808 -FillForegnd "RGB(255,255,255)" -LinePattern 0 
Draw-VisioItem -Master "vCloud Availability" -X 9.9677 -Y 8.7447 -Width 0.956 -Height 0.8166
Draw-VisioItem -Master "Rectangle" -X 9.9232 -Y 7.3064 -Width 2.5312 -Height 1.0825 -FillForegnd "RGB(29,62,125)" `
  -LinePattern 1 -LineWeight "1 pt" -LineColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 9.1094 -Y 7.3064 -Width 0.5937 -Height 0.5937 -FillForegnd "RGB(255,255,255)" `
  -LinePattern 0
Draw-VisioItem -Master "Site Recovery" -X 9.1104 -Y 7.3007 -Width 0.4708 -Height 0.4708
Draw-VisioText -X 10.3125 -Y 7.3192 -Width 1.6875 -Height 0.9875 -Text "Fault Tolerance & Disaster Recovery" -CharSize "18 pt" -LinePattern "0" -FillForegndTrans "100%" -CharColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 9.9232 -Y 5.8955 -Width 2.5312 -Height 1.0825 -FillForegnd "RGB(29,62,125)" `
  -LinePattern 1 -LineWeight "1 pt" -LineColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 9.1094 -Y 5.8955 -Width 0.5937 -Height 0.5937 -FillForegnd "RGB(255,255,255)" `
  -LinePattern 0
Draw-VisioItem -Master "Data Protection" -X 9.1227 -Y 5.8822 -Width 0.4708 -Height 0.4708
Draw-VisioText -X 10.3404 -Y 5.9019 -Width 1.3725 -Height 0.5102 -Text "Backup & Restore" -CharSize "18 pt" -LinePattern "0" -FillForegndTrans "100%" -CharColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 9.9232 -Y 4.5227 -Width 2.5312 -Height 1.0825 -FillForegnd "RGB(29,62,125)" `
  -LinePattern 1 -LineWeight "1 pt" -LineColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 9.1094 -Y 4.5227 -Width 0.5937 -Height 0.5937 -FillForegnd "RGB(255,255,255)" `
  -LinePattern 0
Draw-VisioItem -Master "VR" -X 9.1083 -Y 4.5227 -Width 0.4708 -Height 0.4708
Draw-VisioText -X 10.3737 -Y 4.5215 -Width 1.3725 -Height 0.2878 -Text "Replication" -CharSize "18 pt" -LinePattern "0" -FillForegndTrans "100%" -CharColor "RGB(255,255,255)"

# Step 12.
# Draw Security and Compliance Rectangle, Set Size, Set Colour
# Draw Text, Set Size, Color
# Icon Secure State Background Rectangle, Set Size, Set Colour
# Draw Icon Secure State
# Draw Identity and Access Management Rectangle, Set Size, Set Colour, Set Line Weight
# Icon Identity Background Rectangle, Set Size, Set Colour
# Draw Icon Identity
# Draw Text, Set Size, Color
# Draw Industry Regulations Rectangle, Set Size, Set Colour, Set Line Weight
# Icon Book Background Rectangle, Set Size, Set Colour
# Draw Icon Book
# Draw Text, Set Size, Color
# Draw Security Policies Rectangle, Set Size, Set Colour, Set Line Weight
# Icon License Background Rectangle, Set Size, Set Colour
# Draw Icon License
# Draw Text, Set Size, Color
Draw-VisioItem -Master "Rectangle" -X 12.8734 -Y 6.9741 -Width 2.7531 -Height 6.2451 -FillForegnd "RGB(100,177,69)" -LinePattern 0 
Draw-VisioText -X 12.8512 -Y 9.7286 -Width 1.4225 -Height 0.5174 -Text "Security and Compliance" -CharSize "18 pt" -CharStyle 17 -CharColor "RGB(255,255,255)" -LinePattern "0" -FillForegndTrans "100%"
Draw-VisioItem -Master "Rectangle" -X 12.8734 -Y 8.6529 -Width 2.5312 -Height 1.1808 -FillForegnd "RGB(255,255,255)" -LinePattern 0 
Draw-VisioItem -Master "Secure State" -X 12.8863 -Y 8.7447 -Width 0.956 -Height 0.8166
Draw-VisioItem -Master "Rectangle" -X 12.8607 -Y 7.3064 -Width 2.5312 -Height 1.0825 -FillForegnd "RGB(100,177,69)" `
  -LinePattern 1 -LineWeight "1 pt" -LineColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 12.0544 -Y 7.3064 -Width 0.5937 -Height 0.5937 -FillForegnd "RGB(255,255,255)" `
  -LinePattern 0
Draw-VisioItem -Master "Identity" -X 12.0505 -Y 7.3062 -Width 0.4708 -Height 0.3668
Draw-VisioText -X 13.2012 -Y 7.3192 -Width 1.6875 -Height 0.9875 -Text "Identity and Access Management" -CharSize "18 pt" -LinePattern "0" -FillForegndTrans "100%" -CharColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 12.8607 -Y 5.8955 -Width 2.5312 -Height 1.0825 -FillForegnd "RGB(100,177,69)" `
  -LinePattern 1 -LineWeight "1 pt" -LineColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 12.0544 -Y 5.8955 -Width 0.5937 -Height 0.5937 -FillForegnd "RGB(255,255,255)" `
  -LinePattern 0
Draw-VisioItem -Master "Book" -X 12.0521 -Y 5.8947 -Width 0.4708 -Height 0.4708
Draw-VisioText -X 13.2291 -Y 5.9019 -Width 1.3725 -Height 0.5102 -Text "Industry Regulations" -CharSize "18 pt" -LinePattern "0" -FillForegndTrans "100%" -CharColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 12.8607 -Y 4.5227 -Width 2.5312 -Height 1.0825 -FillForegnd "RGB(100,177,69)" `
  -LinePattern 1 -LineWeight "1 pt" -LineColor "RGB(255,255,255)"
Draw-VisioItem -Master "Rectangle" -X 12.0544 -Y 4.5227 -Width 0.5937 -Height 0.5937 -FillForegnd "RGB(255,255,255)" `
  -LinePattern 0
Draw-VisioItem -Master "License" -X 12.0625 -Y 4.5227 -Width 0.4708 -Height 0.4708
Draw-VisioText -X 13.2513 -Y 4.5215 -Width 1.3725 -Height 0.5102 -Text "Security Policies" -CharSize "18 pt" -LinePattern "0" -FillForegndTrans "100%" -CharColor "RGB(255,255,255)"

# Step 13.
# Resise Page To Fit Contents
Resize-VisioPageToFitContents

# Step 14.
# Save Document
$DiagramFileName = $VCFasCodeHomeFolder + "\" + 'SDDCConceptDiagram.vsd'
Save-VisioDocument -File $DiagramFileName

# Step 15.
# Quit Application
Close-VisioApplication

The logic of this script is described in the comments to the code.

The author added additional icons to the diagram for better visual perception. The files vmw_icons.vssx and VMware_vCenter_Orchestrator_Shapes.vssx are used as a library of icons.

All used artifacts are located on the VCFasCode GitHub resource.

Bill Of Materials


During the work on this article was used:

  • Dell Vostro 3500 notebook with Microsoft Windows 10 Pro version 22H2 Operating system, 64 bit;
  • Software: Microsoft Visio 2021 MSO (Version 2407 Build 16.0.17830.20166) 64-bit;
  • Task automation and configuration management scripting language: Powershell 5.1.19041.4780;
  • Powershell script module: PSVisio v3.7;
  • Code for creating the diagram Conceptual Architecture of a Software Defined Data Center: SDDCconceptDiagram.ps1;
  • Visio stensils icon libraries: vmw_icons.vssx and VMware_vCenter_Orchestrator_Shapes.vssx files.

Brief Summary


The main theses of this article were the initial steps in the author’s approach to the storyline “Vmware Cloud Foundation as Code…”.

We reminded ourselves to understand the life cycle of any IT solution. The PSVisio Powershell script module was described, which will be actively used to visualize the various architectural levels of the VMware Cloud Foundation ecosystem and the third-party systems required for its operation.

We completed the first step: we created a visual diagram Conceptual Architecture of a Software-Defined Data Center using code.

This approach when using this code example has a significant drawback – it is a large number of parameters that form the properties of the diagram objects among the code functions. This creates an issue with code transparency and reusability.

Therefore, in the following publications of the “Vmware Cloud Foundation as Code…” cycle, we will focus on the following points:

  • Code reuse concept;
  • Diagram of the VCF architecture: Management and Workload Domains as Code;
  • Diagram of the architecture of third-party services that are necessary for building a VCF solution as Code.

Follow the news until the meeting is on air in a few days.
Sincerely, AIRRA.

Posted in Architecture, Cloud, Code, Microsoft, Programming, Technology, VMware | Tagged , , , , , , , , , , , , , , , , , , , , , | Leave a comment

VMware Training. Year 2023. Part 18. Introduction. Authorized Training: Virtual Cloud Network: VMware HCX. Brief Summary.

Introduction


Hello to all readers of my blog!

In the previous article of the series “VMware Training. Year 2023″ we considered a list of training programs in the direction of Virtual Cloud Network: vRealize Network Insight.

Today we will talk about the main training programs in the field Virtual Cloud Network: VMware HCX.

VMware HCX


VMware HCX is an application mobility platform designed for simplifying application migration, rebalancing workloads, and optimizing disaster recovery across data centers and clouds.

Key current VMware HCX technology training programs are:

VMware HCX: Management and Operations

  • Duration: 4 days.
  • Level of difficulty: Intermediate (L300).
  • Target audience:
    • System administrators;
    • System engineers;
    • Migration engineers;
    • Migration architects.
  • Prerequisites: This course has the following prerequisites:
    • VMware NSX-T: Install, Configure, Manage [V3.0] or equivalent strong networking experience;
    • VMware vSphere: Install, Configure, Manage [V7];
    • Disaster recovery and business continuity fundamentals.

This four-day course gives you knowledge and practical exercises sufficient to manage VMware HCX and to migrate virtual machines using VMware HCX. The course focuses on configuration and management of VMware HCX. The course equips system administrators with the knowledge, skills, and abilities to achieve competence in migrating virtual machines.

VMware HCX: Deploy, Configure, Manage

  • Duration: 3 days.
  • Level of difficulty: Intermediate (L300).
  • Target audience: System administrators, system engineers, migration engineers, and migration architects.
  • Prerequisites: This course has the following prerequisites:
    • VMware NSX: Install, Configure, Manage [V4.0] or equivalent strong networking experience;
    • VMware vSphere: Install, Configure, Manage [V8];
    • Disaster recovery and business continuity fundamentals.

This three-day training course provides you with the knowledge, skills, and abilities to achieve competence with VMware HCX. This course teaches you how to deploy the different architectural components of HCX, and perform the tasks required to migrate and rebalance workloads across data centers and clouds.

Brief Summary


In this article, we got acquainted with the main training programs in the field of Virtual Cloud Network: VMware HCX.

In the next publication of the cycle “VMware Training. Year 2023″ we will talk about training programs in the field of Anywhere Workspace: Horizon 8.

Follow the news until the meeting is on air in a few days.
Sincerely, AIRRA.

Posted in Cloud, Education, Technology, Training, Virtualization, VMware | Tagged , , , , , , , , , , , | Leave a comment

Anything as Code: Check Uploaded File Hash. Introduction. Function Check-UploadedFileHash. Brief Summary.

Introduction


Hello to all readers of the SDDC and Architecture, Solution, Implementation and Operations as Code blog.

Today, I will continue to talk about such a conceptual approach as Operations as Code as a component of the Anything as Code strategy.

In the previous post, Anything as code: Upload File to ESXi Datasore, I talked about the function that performs the task of uploading a file to the ESXi datasore. Functions are passed to the input the necessary parameters in the form of a variable, changing which you can also use a code reuse strategy.

Today we will take the next step and consider the following situation: The file is uploaded to the datastore of the hypervisor, but during operation we observe some errors. So I want to be sure that the file was uploaded correctly. To do this, you need to calculate the hash of the file and compare it with the correct one.

Moreover, for the efficiency of the work process, this action should be performed on the hypervisor side with the appropriate built-in tools.

So, for your attention, the PowerShell function Check-UploadedFileHash.

Check-UploadedFileHash


So let’s look at the code for the Check-UploadedFileHash function:

Function Check-UploadedFileHash {

<#
.SYNOPSIS
    Check file Hash Uploaded to ESXi datastore.  

.DESCRIPTION
    Check file Hash Uploaded to ESXi datastore. 

.PARAMETER Target
    Name or IP Address of the VMware ESXi.

.PARAMETER File
    Name of file.

.PARAMETER Datastore
    Name of ESXi Datastore.

.PARAMETER Folder
    Name of ESXi Datastore Folder.

.PARAMETER Algorithm
    Algorithm for calculate Hash.

.PARAMETER Hash
    Reference File Hash.

.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  10.08.2023
    Purpose/Change: Initial script development

    Version:        0.2
    Author:         Andrii Romanenko
    Change Date:    02.01.2024
    Purpose/Change: Purpose/Change: Reorganize Function. Add Workflow Time Measuring External Function: Get-CalculateWorkingTime.
                                                         Add ValidateSet $Algorithm in Input Parameters
                                                         Add Case Algorithm Command and Output
    Version:        0.3
    Author:         Andrii Romanenko
    Change Date:    08.01.2024
    Purpose/Change: Purpose/Change: Reorganize Function. Rename function name to Check-UploadedFileHash and some variables.

.EXAMPLE

    $Parameters = @{
        Target    = $ESXiHost
        Datastore = $ISODatastore
        Folder    = "ISO\"
        File      = "en_windows_8_1_x64_dvd_2707217.iso"
        Algorithm = "SHA256"
        Hash      = "23DCCB255FA73CE6E93B12FEFEEFB7204C1681B9A343B51126D3D79F3A34BCD3"
    }
    Check-UploadedFileHash @Parameters

    $Parameters = @{
        Target    = $ESXiHost
        Datastore = $ISODatastore
        Folder    = "ISO\"
        File      = "en_windows_8_1_x64_dvd_2707217.iso"
        Algorithm = "MD5"
        Hash      = "f104b78019e86e74b149ae5e510f7be9"
    }
    Check-UploadedFileHash @Parameters

    $Parameters = @{
        Target    = $ESXiHost
        Datastore = $ISODatastore
        Folder    = "ISO\"
        File      = "en_windows_8_1_x64_dvd_2707217.iso"
        Algorithm = "SHA1"
        Hash      = "bc2f7ff5c91c9f0f8676e39e703085c65072139b"
    }
    Check-UploadedFileHash @Parameters

    $Parameters = @{
        Target    = $ESXiHost
        Datastore = $ISODatastore
        Folder    = "ISO\"
        File      = "en_windows_8_1_x64_dvd_2707217.iso"
        Algorithm = "SHA512"
        Hash      = "25446f98ea6cf35e95ecb0cb3ff9584e67c252d78ca0ac98f08e97d9aa62ddf537ea9c55f6e730abfa09b5759c16d4d2a6ad64ff356a62db914495f203b92807"
    }
    Check-UploadedFileHash @Parameters
#>

param ( 
    [Parameter(Mandatory)][string]$Target,
    [Parameter(Mandatory)][string]$File,
    [Parameter(Mandatory)][string]$Datastore,
    [Parameter(Mandatory)][string]$Folder,
    [Parameter(Mandatory)][ValidateSet('SHA1','SHA256','SHA512','MD5')][string]$Algorithm,
    [Parameter(Mandatory)][string]$Hash
)

# Get start time of the Check File Hash operation
$StartTime = Get-Date           
$Message = "Begin Check Hash: "  + $Image + " on Datastore: " + $Datastore + " on Target:" + $Target + "."
Write-Host -ForegroundColor Green $Message

# Check if SSH service on ESXI is running
$SSHServiceStatus = Get-VMHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" }
If ($SSHServiceStatus.Running -eq "True")
{
$Message = "SSH Service is running. Nothing To Do."
Write-Host -ForegroundColor Green $Message
}
Else
{
$Message = "SSH Service is NOT running. Starting Service"
Write-Host -ForegroundColor Red $Message
Get-VMHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" } | Start-VMHostService
}

# Open SSH session
$Message = "Open SSH Session to host: " + $Target + "."
Write-Host -ForegroundColor Green $Message
$SSHSession = New-SSHSession -ComputerName $Target –AcceptKey -Credential $Script:ESXISessionCredentials

# Check File Hash
$Message = "Begin Calculate Hash of file: " + $File + " on Datastore: " + $Datastore + "." 
Write-Host -ForegroundColor Green $Message

# Get Datasore ID
$DataStoreID = (Get-VMHost | Get-Datastore -Name $Datastore)
$DataStoreID = $DataStoreID.ID.Substring(10)

# Case AlgoritmCommand
Switch ($Algorithm) {
    "SHA1" { $AlgorithmCommand = "sha1sum"}
    "SHA256" { $AlgorithmCommand = "sha256sum"}
    "SHA512" { $AlgorithmCommand = "sha512sum"}
    "MD5" { $AlgorithmCommand = "md5sum"}
}

$SSHCommand = $AlgorithmCommand
$SSHCommand += ' /vmfs/volumes/'
$SSHCommand += $DataStoreID
$SSHCommand += '/'
$SSHCommand += $Folder.Replace("\", "/")
$SSHCommand += $File

$Result = Invoke-SSHCommand -SSHSession $SSHSession -Command $SSHCommand
#Write-Host $Result.Output

# Case Algoritm Output
Switch ($Algorithm) {
    "SHA1" { $HashResult = $Result.Output.Substring(0,40)}
    "SHA256" { $HashResult = $Result.Output.Substring(0,64)}
    "SHA512" { $HashResult = $Result.Output.Substring(0,128)}
    "MD5" { $HashResult = $Result.Output.Substring(0,32)}
}

$Message = "End Calculate Hash of file: " + $File + " on Datastore: " + $Datastore + "." 
Write-Host -ForegroundColor Green $Message

# Check Result
$Message = "Begin Check Hash of file: " + $File + "." 
Write-Host -ForegroundColor Green $Message

$Result=$HashResult.ToUpper().Equals($Hash.ToUpper())

If ($Result -eq "True")
{
$Message = "Hash Valid"
Write-Host -ForegroundColor Green $Message
}
Else
{
$Message = "Hash Not Valid"
Write-Host -ForegroundColor Red $Message
}
$Message = "End Check Hash of file: " + $File + "." 
Write-Host -ForegroundColor Green $Message

# Remove SSH Session
$Message = "Close SSH Session to host: " + $Target + "."
Write-Host -ForegroundColor Green $Message
Remove-SSHSession $SSHSession | Out-Null

# Get end time of the operation
$EndTime = Get-Date

# Calculate Elapsed Time of the operation
Get-CalculateWorkingTime -StartTime $StartTime -EndTime $EndTime
}

The function accepts the following mandatory parameters as input in the form of the @Parameters variable:

  • Target – Name or IP Address of the VMware ESXi;
  • File – Checked File Name;
  • Datastore – Name of ESXi Datastore;
  • Folder – Name of ESXi Datastore Folder;
  • Algorithm – Algorithm for calculate Hash;
  • Hash – Reference File Hash.

At the beginning of work, the start time is fixed in the form of the $StartTime variable.

The function will use the Posh-SSH Powershell module for its work to connect to the ESXi hypervisor and execute commands in the SSH environment. Therefore, the next step is to check whether this service is running on the hypervisor side, and if not, to start it.

This action is performed by standard PowerCLI cmdlets Get-VMHost, Get-VMHostService, Start-VMHostService.

Next, open an SSH session to the ESXi host New-SSHSession. This cmdlet is already from the Posh-SSH module.

For the algorithm to calculate the hash of the file, you will need to specify the path to the location of the file on the ESXi datastore. To do this, you should get a datastore identifier:

$DataStoreID = (Get-VMHost | Get-Datastore -Name $Datastore)

$DataStoreID = $DataStoreID.ID.Substring(10)

Different algorithms can be used to calculate the hash of a file. Their list is limited to the input variable $Algorithm and contains the following values: ‘SHA1′,’SHA256′,’SHA512′,’MD5’.

Depending on the value of the variable, the appropriate command will be used: sha1sum, sha256sum, sha512sum, md5sum. The Switch ($Algorithm) Powershell structure helps in this.

The $SSHCommand variable forms a command that should be sent to the SSH session. The result of the SSH Command goes into the $Result variable.

Depending on the hash calculation algorithm, the variable will contain a text fragment of different lengths. Therefore, depending on the $Algorithm variable, the required number of characters will be allocated. What will correspond to the calculated hash: sha1sumSubstring(0.40), sha256sumSubstring(0.64), sha512sumSubstring(0,128), md5sumSubstring(0,32).

Finally, the calculated hash is compared with the reference value from the $Hash variable. The result is displayed as Hash Valid or Hash Not Valid in green and red, respectively.

At the end of the work, we delete the SSH Session and calculate the duration of work with the Get-CalculateWorkingTime function, which I talked about in the previous post.

The result of the function is shown in the following figure:

Figure 1. The result of the execution of the Check-UploadedFileHash Powershell function

Brief Summary


So, in today’s post, I’ve shared with you some code snippets that demonstrate the strategy and practice of Operations as Code.

I note that you can use this code at your discretion, adding there, for example, verification codes and handling of exceptional situations, etc.

Also, don’t forget that the function requires the presence of the VMware PowerCLI and Posh-SSH.

That’s all for today. Follow the next publications of this direction.

Follow the news until the meeting is on air in a few days.
Sincerely, AIRRA.

Posted in Code, Programming, Technology, Virtualization, VMware | Tagged , , , , , , , , , , , , | Leave a comment

VMware Training. Year 2023. Part 17. Introduction. Authorized Training: Virtual Cloud Network: VMware vRealize Network Insight. Brief Summary.

Introduction


Hello to all readers of my blog!

In the previous article of the series “VMware Training. Year 2023″ we considered a list of training programs in the direction of Virtual Cloud Network: VMware SD-WAN.

Today we will talk about the main training programs in the field Virtual Cloud Network: vRealize Network Insight.

vRealize Network Insight


vRealize Network Insight is a network monitoring tool that helps you build an optimized, highly available and secure network infrastructure across your cloud environments including NSX, VMware SD-WAN, vSphere, VMware Cloud on AWS and Kubernetes deployments.

Key current VMware vRealize Network Insight technology training programs are:

● VMware vRealize Network Insight: Install, Configure, Manage [V6.1]

  • Duration: 2 days.
  • Level of difficulty: Intermediate (L300).
  • Target audience: Network professionals and who design, build, operate, manage, and troubleshoot software-defined networking and security, and application owners who need visibility across multi-cloud environments.
  • Prerequisites: Students taking this course should have general networking concepts including TCP/IP service and protocols, security knowledge and familiar with NSX architecture.
    • Before taking this course, students are recommended to take the following courses or have equivalent knowledge and experience:
      • VMware NSX-T Data Center: Install, Configure, Manage.

This two-day, hands-on course gives you the skills to deploy and use VMware vRealize Network Insight to ensure an optimized, highly available, and secure infrastructure for your applications. You will learn the features, components, architecture, and benefits of vRealize Network Insight and how to use it to simplify daily operation and troubleshooting tasks.

WARNING! This course was removed from the catalog, and replaced by the following course: VMware Aria Operations for Networks: Install, Configure, Manage.

The courses of the VMware Aria direction will be considered in one of the following publications of this cycle.

Brief Summary


In this article, we got acquainted with the main training programs in the field of Virtual Cloud Network: VMware vRealize Network Insight.

In the next publication of the cycle “VMware Training. Year 2023″ we will talk about training programs in the field of Virtual Cloud Network: VMware HCX.

Follow the news until the meeting is on air in a few days.
Sincerely, AIRRA.

Posted in Education, Monitoring, Network, Technology, Training, Virtualization, VMware | Tagged , , , , , , , , , , | Leave a comment

Anything as Code: Upload File to ESXi Datasore Introduction. Function Upload-FileToDatastore. Get-CalculateWorkingTime. Brief Summary.

Introduction


Hello to all readers of the SDDC and Architecture, Solution, Implementation and Operations as Code blog.

Today we will talk about such a conceptual approach as Operations as Code, which is an integral part of the Anything as Code: strategy. I, as an Architect and Engineer in the field of cloud technologies, have been trying to adhere to this strategy as much as possible for the last ten years.

Today I want to share with you my small developments, which fit nicely into the Operation as Code approach.

Probably, we all constantly face the situation when we need to upload some file to the VMware Virtual Infrastructure Datastore, for example, the installation image of the operating system in order to mount it to the virtual machine.

I wrote a small Powershell function that performs the task of uploading a file to the ESXi datastore. Functions are passed to the input the necessary parameters in the form of a variable, changing which you can also use a code reuse strategy.

Upload-FileToDatastore


So let’s look at the code for the Upload-FileToDatastore function:

Function Upload-FileToDatastore {

<#
.SYNOPSIS
    Upload file to ESXi datastore.

.DESCRIPTION
    Silent deploy the specified file to ESXi datastore.

.PARAMETER Target
    Name or IP Address of the VMware ESXi.

.PARAMETER Path
    Path to source file.

.PARAMETER Source
    Name of source file.

.PARAMETER Datastore
    Name of destination ESXi Datastore.

.PARAMETER Folder
    Name of destination ESXi Datastore Folder.

.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  12.05.2022
    Purpose/Change: Initial script development

    Version:        0.2
    Author:         Andrii Romanenko
    Change Date:    28.09.2022
    Purpose/Change: Add Work Time Measuring.

    Version:        0.3
    Author:         Andrii Romanenko
    Change Date:    30.12.2023
    Purpose/Change: Reorganize Function. Add Workflow Time Measuring External Function: Get-CalculateWorkingTime.

.EXAMPLE

    $Parameters = @{
        Target    = $ESXiHost
        Path      = "c:\!\"
        Source    = "en_windows_server_2019_x64_dvd_4cb967d8.iso"
        Datastore = $ISODatastore
        Folder    = "\ISO"
    }
    Upload-FileToDatastore @Parameters
#>

param ( 
    [Parameter(Mandatory)][string]$Target,
    [Parameter(Mandatory)][string]$Path,
    [Parameter(Mandatory)][string]$Source,
    [Parameter(Mandatory)][string]$Datastore,
    [Parameter(Mandatory)][string]$Folder 
)

# Get start time of the Upload ISO operation
$StartTime = Get-Date           
$Message = "Begin Upload: "  + $Source + " to Datastore: " + $Datastore + " on Target:" + $Target + "."
Write-Host -ForegroundColor Green $Message

# Upload ISO
$ds = Get-VMHost -Name $Target | Get-Datastore $Datastore
New-PSDrive -Location $ds -Name DS -PSProvider VimDatastore -Root "\" > $null
Copy-DatastoreItem -Item $Path$Source -Destination "DS:/$($Folder)"
Remove-PSDrive -Name DS -Confirm:$false

Write-Host -ForegroundColor Green "Upload Finished!"

# Get end time of the Upload ISO operation
$EndTime = Get-Date

# Calculate Elapsed Time of the operation
Get-CalculateWorkingTime -StartTime $StartTime -EndTime $EndTime
}

The function accepts the following mandatory parameters as input in the form of the @Parameters variable:

  • Target – Name or IP Address of the VMware ESXi;
  • Path – Path to source file;
  • Source – Name of source file;
  • Datastore – Name of destination ESXi Datastore;
  • Folder – Name of destination ESXi Datastore Folder.

At the beginning of work, the start time is fixed in the form of the $StartTime variable.

Next, the Datastore parameters of the ESXi Host are entered into the $ds variable.

To access the Datastore for the copy operation, the standard New-PSDrive Powershell commandlet is used. The copy operation is performed by the Copy-DatastoreItem command from VMware PowerCLI.

At the end of the operation, the PSDdrive object is deleted and the copying $EndTime is fixed.

The calculation of the duration of the copying operation is carried out by calling the external function Get-CalculateWorkingTime, which receives the parameters of the start and end of the operation.

The result of the function is shown in the following figure:

Figure 1. The result of the execution of the Upload-FileToDatastore Powershell function.

Get-CalculateWorkingTime


The code for the Get-CalculateWorkingTime function is below.

Function Get-CalculateWorkingTime {

<#
.SYNOPSIS
    Calculate working time of workflow.

.DESCRIPTION
    Calculate working time of workflow.

.PARAMETER StartTime
    Begin Time of Workflow.

.PARAMETER EndTime
    End Time of Workflow.

.NOTES
    Version:        0.1
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  22.03.2023
    Purpose/Change: Initial script development

    Version:        0.2
    Author:         Andrii Romanenko
    Website:        blogs.airra.net
    Creation Date:  14.08.2023
    Purpose/Change: Add time measuring format in hours.

.EXAMPLE
    
    Get-CalculateWorkingTime -StartTime $StartTime -EndTime $EndTime 

#>

param ( 
    [Parameter(Mandatory)][datetime]$StartTime,
    [Parameter(Mandatory)][datetime]$EndTime 
)

# Calculate Elapsed Time of the workflow operation
$ElapsedTime = $EndTime-$StartTime
$ElapsedTime = '{0:hh} h. {0:mm} min. {0:ss} sec.' -f $ElapsedTime 
Write-Host 'Total Operation Duration:'  $ElapsedTime -ForegroundColor Green 
}

Brief Summary


So, in today’s post, I’ve shared with you some code snippets that demonstrate the strategy and practice of Operations as Code.

I note that you can use this code at your discretion, adding there, for example, verification codes and handling of exceptional situations, such as whether there is a connection to the ESXi host or a file with the same name is present, etc.

Also, don’t forget that the function requires the presence of the VMware PowerCLI.

That’s all for today. But in the next publication, I will tell about the function that will help check the already copied file on the datastore for the checksum.

Follow the news until the meeting is on air in a few days.
Sincerely, AIRRA.

Posted in Code, Programming, Technology, Virtualization, VMware | Tagged , , , , , , , , , , | Leave a comment

VMware Training. Year 2023. Part 16. Introduction. Authorized Training: Virtual Cloud Network: VMware SD-WAN. Brief Summary.

Introduction


Hello to all readers of my blog!

In the previous article of the series “VMware Training. Year 2023″ we considered a list of training programs in the direction of VMware NSX Advanced Load Balancer.

Today we will talk about the main training programs in the field Virtual Cloud Network: VMware SD-WAN.

VMware SD-WAN


SD-WAN is the application of software based network technologies that virtualize WAN connections. SD-WAN decouples network software services from underlying hardware to create a virtualized network overlay.

Key current VMware SD-WAN technology training programs are:

● VMware SD-WAN: Deploy and Manage [V4.x]

  • Duration: 2 days.
  • Level of difficulty: Intermediate (L300).
  • Target audience:
    • Experienced system administrators, network administrators, and system integrators responsible for designing and implementing networking solutions;
    • Network and security professionals who work with enterprise and data center networks.
  • Prerequisites: Extensive knowledge of routing and switching is required.
    • You should also have the following understanding or knowledge:
      • Good understanding of TCP/IP services and protocols;
      • Knowledge and working experience of computer networking, including:
        • Switching and routing technologies (L2-L3);
        • Network and application delivery services (L4-L7);
        • Basic understanding of IaaS, SaaS, and public and private cloud.
    • The VMware Certified Professional – Network Virtualization (2020) certification is recommended.

This two-day, hands-on training course provides you with the knowledge, skills, and tools to achieve competency in deploying and managing the VMware SD-WAN by VeloCloud environment. In this course, you are introduced to workflows of various software-defined WAN constructs along with several operational tools that help you deploy and manage VMware SD-WAN by VeloCloud.

● VMware SD-WAN by VeloCloud: Design and Deploy [V3.x]

  • Duration: 3 days.
  • Level of difficulty: Advanced (L400+).
  • Target audience: Any Managed Service Provider who is designing VMware SD-WAN solutions or managing SD-WAN networks for their customers.
  • Prerequisites:
    • Deep understanding of routing and switching technologies;
    • Deep understanding of security solutions, including VPN technologies;
    • Completion of the VMware SD-WAN VTSP Accreditation;
    • Completion of the VMware SD-WAN by VeloCloud: Deploy and Manage course.

Customers demand a scalable, secure, and manageable VMware SD-WAN by VeloCloud. To deliver a successful solution you must understand VMware SD-WAN architecture, know how the features can solve customer use cases, and be able to design a VMware SD-WAN that can be easily deployed, managed, and expanded.

● VMware SD-WAN for Service Providers [V4.x]

  • Duration: 3 days.
  • Level of difficulty: Intermediate (L300).
  • Target audience:
    • Service providers who are designing or using VMware SD-WAN solutions or managing SD-WAN networks for customers;
    • Service providers looking to deliver a managed hybrid WAN with MPLS service;
    • Service providers transforming their MPLS networks for direct access to cloud services and increased network agility.
  • Prerequisites: Before taking this course, you should have completed the following course:
    • VMware SD-WAN: Deploy and Manage;
    • You should also have the following understanding or knowledge:
      • Good understanding of SD-WAN architectures;
      • Experience of operating Linux servers, especially Ubuntu;
      • Knowledge and working experience of computer networking;
      • Experience with routing and switching technologies;
      • Experience with security solutions, including VPN technologies.
    • The VMware SD-WAN VTSP accreditation is recommended.

This three-day, hands-on training course provides you with the advanced knowledge, skills, and tools to achieve competency in operating and troubleshooting the VMware SD-WAN™ environment for service providers.

In this course, you focus on deploying and managing VMware SD-WAN for a service provider, including troubleshooting common issues.

Brief Summary


In this article, we got acquainted with the main training programs in the field of Virtual Cloud Network: SD-WAN.

In the next publication of the cycle “VMware Training. Year 2023″ we will talk about training programs in the field of Virtual Cloud Network: vRealize Network Insight.

Follow the news until the meeting is on air in a few days.
Sincerely, AIRRA.

Posted in Education, Network, Technology, Training, Virtualization, VMware | Tagged , , , , , , , , , , , , , | Leave a comment