Flagged Code Snippets
Set-DeviceVip -vip $nfsVip
PS C:\> Get-DeviceConfigurationStatus | To-json
{
"deviceConfiguration": {
"status": "Complete",
"results": [
{
"declarationName": "Time",
"resultCode": "Success",
"errorCode": "None",
"message": null
},
{
"declarationName": "Update",
"resultCode": "Success",
"errorCode": "None",
"message": null
}
]
}
}
PS C:\>
Get-DeviceConfiguration | To-json | Out-File "<Local path>\TestConfig2.json"
Get-DeviceConfiguration | To-json
PS C:\> Get-DeviceConfiguration | To-json
{
"device": {
"deviceInfo": {
"model": "Azure Stack Edge",
"softwareVersion": "2.2.2075.5523",
"serialNumber": "1HXQG13",
"isActivated": false,
"nodes": [
{
"id": "d0d8cb16-60d4-4970-bb65-b9d254d1a289",
"name": "1HXQG13"
}
]
},
}
}
$newCfg = Set-DeviceConfiguration -DesiredDeviceConfig $p
Get-DeviceConfiguration | To-json
$p = Get-Content -Path "<Local path>\<ConfigFileName.json>" | ConvertFrom-json
$p = Get-Content -Path "<Local path>\<ConfigFileName-two-node-device.json>" | ConvertFrom-json
$ActivationKey = "<Activation key>"
$activation = New-Object PsObject -Property @{ActivationKey=$ActivationKey; ServiceEncryptionKey=""}
$p = Get-DeviceConfiguration
Import-Module "<Local path to PowerShell module>"\PowerShellBasedConfiguration.psm1
Set-Login "https://<IP address>" "<Password1>" "<NewPassword>"
Get-DeviceConfiguration | To-json
$time = New-Object PSObject -Property @{ TimeZone = "Hawaiian Standard Time" }
$update = New-Object PSObject -Property @{ ServerType = "MicrosoftUpdate" }
$pkg = New-Package -Time $time -Update $update
$newCfg = Set-DeviceConfiguration -DesiredDeviceConfig $pkg
Get-DeviceConfigurationStatus | To-json
Get-DeviceConfigurationStatus | To-json
Get-DeviceConfiguration | To-json
Get-DeviceConfiguration | To-json
PS C:\> Get-DeviceConfiguration | To-json
{
"device": {
"deviceInfo": {
"model": "Azure Stack Edge",
"softwareVersion": "2.2.2075.5523",
"serialNumber": "1HXQJ23",
"isActivated": true,
"nodes": [
{
"id": "d0d8ca16-60d4-4970-bb65-b9d254d1a289",
"name": "1HXQG13"
}
]
},
}
}
PS C:\> $p.device.webproxy
isEnabled : False
connectionURI : null
authentication : None
username :
password :
$p.device.webproxy.isEnabled = $true
$p.device.webproxy.connectionURI = "<specify a URI depending on the geographic location of the device>"
PS C:\> $p.device.webproxy
isEnabled : True
connectionURI : http://10.57.48.82:8080
authentication : None
username :
password :
$newCfg = Set-DeviceConfiguration -DesiredDeviceConfig $p
Get-DeviceConfigurationStatus | To-json
Get-DeviceConfiguration | To-json
PS C:\> Get-DeviceConfiguration | To-json
{
"device": {
"deviceInfo": {
"model": "Azure Stack Edge",
"softwareVersion": "2.2.2075.5523",
"serialNumber": "1HXQG13",
"isActivated": false,
"nodes": [
{
"id": "d0d8cb16-60d4-4970-bb65-b9d254d1a289",
"name": "1HXQG13"
}
]
},
}
}
$newCfg = Set-DeviceConfiguration -DesiredDeviceConfig $p
Get-DeviceConfigurationStatus | To-json
Get-DeviceConfiguration | To-json
PS C:\> Get-DeviceConfiguration | To-json
{
"device": {
"deviceInfo": {
"model": "Azure Stack Edge",
"softwareVersion": "3.2.2380.1548",
"serialNumber": "1HXG613",
"isActivated": true,
"nodes": [
{
"id": "9b1817b9-67f5-4631-8466-447b89b829f3",
"name": "HW6C1T2"
},
{
"id": "b4eeebad-9395-4aa8-b6b4-2f2d66eccf58",
"name": "1HXG613"
}
]
},
"deviceEndpoint": {
"name": "DBE-1HXG613",
"dnsDomain": "microsoftdatabox.com"
},
"encryptionAtRestKeys": null,
"network": {
"dhcpPolicy": "AttemptRenew",
"interfaces": [
{
"name": "Port1",
"nodeName": "1HXG613",
"nodeId": "b4eeebad-9395-4aa8-b6b4-2f2d66eccf58",
"isDhcpEnabled": false,
"iPv4": {
"address": "192.0.2.0/24",
"subnetMask": "255.255.255.0",
"gateway": null
},
"iPv6": null,
"dnsServerAddresses": null,
"dnsSuffix": null,
"routes": null,
"ipConfigType": "IP"
},
{
"name": "Port1",
"nodeName": "HW6C1T2",
"nodeId": "9b1817b9-67f5-4631-8466-447b89b829f3",
"isDhcpEnabled": false,
"iPv4": {
"address": "192.0.2.0/24",
"subnetMask": "255.255.255.0",
"gateway": null
},
"iPv6": null,
"dnsServerAddresses": null,
"dnsSuffix": null,
"routes": null,
"ipConfigType": "IP"
},
{
"name": "Port2",
"nodeName": "1HXG613",
"nodeId": "b4eeebad-9395-4aa8-b6b4-2f2d66eccf58",
"isDhcpEnabled": true,
"iPv4": {
"address": "192.0.2.0/24",
"subnetMask": "255.255.248.0",
"gateway": "10.126.72.1"
},
"iPv6": null,
"dnsServerAddresses": [
"10.50.50.50",
"10.50.10.50"
],
"dnsSuffix": "corp.microsoft.com",
"routes": null,
"ipConfigType": "IP"
},
{
"name": "Port2",
"nodeName": "HW6C1T2",
"nodeId": "9b1817b9-67f5-4631-8466-447b89b829f3",
"isDhcpEnabled": true,
"iPv4": {
"address": "192.0.2.0/24",
"subnetMask": "255.255.248.0",
"gateway": "10.126.72.1"
},
"iPv6": null,
"dnsServerAddresses": [
"10.50.50.50",
"10.50.10.50"
],
"dnsSuffix": "corp.microsoft.com",
"routes": null,
"ipConfigType": "IP"
},
{
"name": "Port3",
"nodeName": "1HXG613",
"nodeId": "b4eeebad-9395-4aa8-b6b4-2f2d66eccf58",
"isDhcpEnabled": true,
"iPv4": {
"address": "192.0.2.0/24",
"subnetMask": "255.255.0.0",
"gateway": null
},
"iPv6": null,
"dnsServerAddresses": [
"192.168.0.1"
],
"dnsSuffix": "wdshcsso.com",
"routes": null,
"ipConfigType": "IP"
},
{
"name": "Port3",
"nodeName": "HW6C1T2",
"nodeId": "9b1817b9-67f5-4631-8466-447b89b829f3",
"isDhcpEnabled": true,
"iPv4": {
"address": "192.0.2.0/24",
"subnetMask": "255.255.0.0",
"gateway": null
},
"iPv6": null,
"dnsServerAddresses": [
"192.168.0.1"
],
"dnsSuffix": "wdshcsso.com",
"routes": null,
"ipConfigType": "IP"
},
{
"name": "Port4",
"nodeName": "1HXG613",
"nodeId": "b4eeebad-9395-4aa8-b6b4-2f2d66eccf58",
"isDhcpEnabled": true,
"iPv4": {
"address": "192.0.2.0/24",
"subnetMask": "255.255.0.0",
"gateway": null
},
"iPv6": null,
"dnsServerAddresses": [
"192.168.0.1"
],
"dnsSuffix": "wdshcsso.com",
"routes": null,
"ipConfigType": "IP"
},
{
"name": "Port4",
"nodeName": "HW6C1T2",
"nodeId": "9b1817b9-67f5-4631-8466-447b89b829f3",
"isDhcpEnabled": true,
"iPv4": {
"address": "192.168.6.99",
"subnetMask": "255.255.0.0",
"gateway": null
},
"iPv6": null,
"dnsServerAddresses": [
"192.168.0.1"
],
"dnsSuffix": "wdshcsso.com",
"routes": null,
"ipConfigType": "IP"
},
{
"name": "Port5",
"nodeName": "1HXG613",
"nodeId": "b4eeebad-9395-4aa8-b6b4-2f2d66eccf58",
"isDhcpEnabled": true,
"iPv4": {
"address": "192.0.2.0/24",
"subnetMask": "255.255.0.0",
"gateway": null
},
"iPv6": null,
"dnsServerAddresses": [
"192.168.0.1"
],
"dnsSuffix": "wdshcsso.com",
"routes": null,
"ipConfigType": "IP"
},
{
"name": "Port5",
"nodeName": "HW6C1T2",
"nodeId": "9b1817b9-67f5-4631-8466-447b89b829f3",
"isDhcpEnabled": true,
"iPv4": {
"address": "192.0.2.0/24",
"subnetMask": "255.255.0.0",
"gateway": null
},
"iPv6": null,
"dnsServerAddresses": [
"192.168.0.1"
],
"dnsSuffix": "wdshcsso.com",
"routes": null,
"ipConfigType": "IP"
},
{
"name": "Port6",
"nodeName": "1HXG613",
"nodeId": "b4eeebad-9395-4aa8-b6b4-2f2d66eccf58",
"isDhcpEnabled": true,
"iPv4": {
"address": "192.0.2.0/24",
"subnetMask": "255.255.0.0",
"gateway": null
},
"iPv6": null,
"dnsServerAddresses": [
"192.168.0.1"
],
"dnsSuffix": "wdshcsso.com",
"routes": null,
"ipConfigType": "IP"
},
{
"name": "Port6",
"nodeName": "HW6C1T2",
"nodeId": "9b1817b9-67f5-4631-8466-447b89b829f3",
"isDhcpEnabled": true,
"iPv4": {
"address": "192.0.2.0/24",
"subnetMask": "255.255.0.0",
"gateway": null
},
"iPv6": null,
"dnsServerAddresses": [
"192.168.0.1"
],
"dnsSuffix": "wdshcsso.com",
"routes": null,
"ipConfigType": "IP"
}
],
"vSwitches": [
{
"name": "vSwitch1",
"interfaceName": [ "Port2" ],
"enabledForCompute": true,
"enabledForStorage": false,
"enabledForMgmt": true,
"supportsAcceleratedNetworking": false,
"enableEmbeddedTeaming": true,
"ipAddressPools": [
{
"name": "KubernetesNodeIPs",
"ipAddressRange": "10.126.75.200-10.126.75.202"
},
{
"name": "KubernetesServiceIPs",
"ipAddressRange": "10.126.75.206-10.126.75.208"
}
],
"mtu": 1500
},
{
"name": "vSwitch2",
"interfaceName": [ "Port3" ],
"enabledForCompute": false,
"enabledForStorage": true,
"enabledForMgmt": false,
"supportsAcceleratedNetworking": false,
"enableEmbeddedTeaming": true,
"ipAddressPools": [
],
"mtu": 1500
},
{
"name": "TestvSwitch",
"interfaceName": [ "Port5" ],
"enabledForCompute": false,
"enabledForStorage": false,
"enabledForMgmt": false,
"supportsAcceleratedNetworking": true,
"enableEmbeddedTeaming": false,
"ipAddressPools": [
],
"mtu": 9000
}
],
"virtualNetworks": [
{
"name": "TestvSwitch-internal",
"vSwitchName": "TestvSwitch",
"vlanId": 0,
"subnetMask": "255.255.255.0",
"gateway": "192.0.2.0/24",
"network": "192.0.2.0/24",
"enabledForKubernetes": false,
"ipAddressPools": [
{
"name": "VirtualMachineIPs",
"ipAddressRange": "192.0.2.0/24"
}
]
}
]
},
"time": {
"timeZone": "Pacific Standard Time",
"primaryTimeServer": "time.windows.com",
"secondaryTimeServer": null
},
"update": {
"serverType": "None",
"wsusServerURI": null
},
"webProxy": {
"isEnabled": false,
"connectionURI": null,
"authentication": "None",
"username": null,
"password": null
}
}
}
PS C:\>
$p = New-Package -Activation $activation
$newCfg = Set-DeviceConfiguration -DesiredDeviceConfig $p
Get-DeviceConfigurationStatus | To-json
PS C:\> Get-DeviceConfigurationStatus | to-json
{
"deviceConfiguration": {
"status": "Complete",
"results": [
{
"declarationName": "Network",
"resultCode": "Success",
"errorCode": "None",
"message": null
},
{
"declarationName": "Activation",
"resultCode": "Success",
"errorCode": "None",
"message": null
},
{
"declarationName": "DeviceEndpoint",
"resultCode": "Success",
"errorCode": "None",
"message": null
},
{
"declarationName": "WebProxy",
"resultCode": "Success",
"errorCode": "None",
"message": null
},
{
"declarationName": "Time",
"resultCode": "NotExecuted",
"errorCode": "None",
"message": ""
},
{
"declarationName": "Update",
"resultCode": "NotExecuted",
"errorCode": "None",
"message": ""
}
]
}
}
Get-DeviceConfiguration | To-json
PS C:\> Get-DeviceDiagnostic | To-json
{
"lastRefreshTime": "2022-09-27T20:12:10.643768Z",
"status": "Complete",
"diagnostics": [
{
"test": "System software",
"category": "Software",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Disks",
"category": "Hardware, Disk",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Power Supply Units",
"category": "Hardware",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Network interfaces",
"category": "Hardware",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "CPUs",
"category": "Hardware",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Network settings ",
"category": "Logical, Network",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Internet connectivity",
"category": "Logical, Network",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Web proxy",
"category": "Logical, Network",
"status": "NotApplicable",
"recommendedActions": ""
},
{
"test": "Time sync ",
"category": "Logical, Time",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Azure portal connectivity",
"category": "Logical, Network, AzureConnectivity",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Azure storage account credentials",
"category": "Logical, AzureConnectivity",
"status": "NotApplicable",
"recommendedActions": ""
},
{
"test": "Software update readiness",
"category": "Logical, Update",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "User passwords",
"category": "Logical, PasswordExpiry",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Azure consistent services health check",
"category": "ACS",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Certificates",
"category": "Certificates",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Azure container read/write",
"category": "Logical, Network, AzureConnectivity",
"status": "NotApplicable",
"recommendedActions": ""
},
{
"test": "Azure Edge compute runtime",
"category": "Logical, AzureEdgeCompute",
"status": "Succeeded",
"recommendedActions": ""
},
{
"test": "Compute acceleration",
"category": "Hardware, Logical",
"status": "Succeeded",
"recommendedActions": ""
}
]
}
$acsVip = New-Object PSObject -Property @{ Type = "ACS"; VipAddress = "10.57.51.32"; ClusterNetworkAddress = "10.57.48.0"; IsDhcpEnabled = $false }
Set-DeviceVip -vip $acsVip
{
"acsVIP": {
"type": "ACS",
"name": "Azure Consistent Services",
"address": "10.57.51.32",
"network": {
"name": "Cluster Network 3",
"address": "10.57.48.0",
"subnet": "255.255.248.0",
"dhcpEnabled": false
},
"isDhcpEnabled": false
}
}
PS C:\>
$acsVip = New-Object PSObject -Property @{ Type = "ACS"; VipAddress = $null; ClusterNetworkAddress = "10.57.48.0"; IsDhcpEnabled = $true }
Set-DeviceVip -vip $acsVip
{
"acsVIP": {
"type": "ACS",
"name": "Azure Consistent Services",
"address": "10.57.53.225",
"network": {
"name": "Cluster Network 3",
"address": "10.57.48.0",
"subnet": "255.255.248.0",
"dhcpEnabled": true
},
"isDhcpEnabled": true
},
}
PS C:\>
$nfsVip = New-Object PSObject -Property @{ Type = "NFS"; VipAddress = "10.57.53.215"; ClusterNetworkAddress = "10.57.48.0"; IsDhcpEnabled = $false }
Set-DeviceVip -vip $nfsVip
{
"nfsVIP": {
"type": "NFS",
"name": "Network File System",
"address": "10.57.53.215",
"network": {
"name": "Cluster Network 3",
"address": "10.57.48.0",
"subnet": "255.255.248.0",
"dhcpEnabled": false
},
"isDhcpEnabled": false
}
}
PS C:\>
$nfsVip = New-Object PSObject -Property @{ Type = "NFS"; VipAddress = $null; ClusterNetworkAddress = "10.57.48.0"; IsDhcpEnabled = $true }
{
"nfsVIP": {
"type": "NFS",
"name": "Network File System",
"address": "10.57.53.228",
"network": {
"name": "Cluster Network 3",
"address": "10.57.48.0",
"subnet": "255.255.248.0",
"dhcpEnabled": true
},
"isDhcpEnabled": true
}
}
PS C:\>
Get-DeviceConfiguration | To-json
Set-DeviceLogConsent -logConsent $true
PS C:\> Get-DeviceLogConsent
False
PS C:\> Set-DeviceLogConsent -logConsent $true
True
PS C:\> Get-DeviceLogConsent
True
PS C:\>
Get-DeviceDiagnostic | To-json