Skip to content

Results Output

Matthew Kelly edited this page Jul 30, 2017 · 1 revision

Structure

Fogg now returns a resultant object on a successful deployment, containing details about what was just deployed. If you don't want Fogg to return this output than supply the -NoOutput argument when running Fogg.

The result object contains information for each Resource Group that is deployed, such as the Location, StorageAccount, VNets and VMs. The object is a simple Hash Table and can be tranversed like any hash table/json object in PowerShell.

The basics of the object look like the following for one Resource Group:

{
    "resource-group-name": {
        "Location": "westeurope",
        "VirtualNetwork": {
            "Name": "name-vnet",
            "ResourceGroupName": "resource-group-name",
            "Address": "10.1.0.0/16"
        },
        "StorageAccount": {
            "Name": "namestdsa"
        },
        "VirtualMachineInfo": {
            "vm-tag": {
                "Subnet": {
                    "Name": "name-vm-tag-snet",
                    "AddressPrefix": "10.1.0.0/24"
                },
                "AvailabilitySet": "name-vm-tag-as",
                "LoadBalancer": {
                    "Name": "name-vm-tag-lb",
                    "PublicIP": "52.101.205.32",
                    "PrivateIP": "10.1.0.3",
                    "Port": 443
                },
                "VirtualMachines": [
                    {
                        "Name": "name-vm-tag1",
                        "PrivateIP": "10.1.0.1",
                        "PublicIP": "52.139.128.96"
                    },
                    {
                        "Name": "name-vm-tag2",
                        "PrivateIP": "10.1.0.2",
                        "PublicIP": "52.112.134.97"
                    }
                ]
            }
        }
    }
}

With the result object, you are now able to run further remote commands on just deployed VMs, as you can retrieve a VM's IP via:

$ip = $result.'resource-group-name'.VirtualMachineInfo.'vm-tag'.VirtualMachines[0].PublicIP
# returns: 52.139.128.96 for 'name-vm-tag1'
Clone this wiki locally