I want to read the data from properties file in powershell using pester framework, but facing an error.
Properties file:
vmsize1='Standard_D3_V2'
vmsize2='Standard_DS1_V2'
Code:
Context "VIRTUAL MACHINE" {
$file_content = get-content "$here/properties.txt" -raw
$configuration = ConvertFrom-String($file_content)
$environment = $configuration.'vmsize1'
It "CHECKING THE SIZE OF VM" {
$environment | Should -Be "Standard_D3_V2"
}
}
Output:
Context VIRTUAL MACHINE
[-] CHECKING THE SIZE OF VM 78ms
Expected 'Standard_D3_V2', but got $null.
694: $environment | Should -Be "Standard_D3_V2"
Please help me to resolve this issue!