Upgrade, backup, and restore SDN infrast·续

$Backup = New-NetworkControllerBackup -ConnectionURI $URI -Credential $Credential -Properties $BackupProperties -ResourceId $BackupTime -Force


### Example: Checking the status of a Network Controller backup operation

```powershell

PS C:\ > Get-NetworkControllerBackup -ConnectionUri $URI -Credential $Credential -ResourceId $Backup.ResourceId

| ConvertTo-JSON -Depth 10

{

"Tags":  null,

"ResourceRef":  "/networkControllerBackup/2017-04-25T16_53_13",

"InstanceId":  "c3ea75ae-2892-4e10-b26c-a2243b755dc8",

"Etag":  "W/\"0dafea6c-39db-401b-bda5-d2885ded470e\"",

"ResourceMetadata":  null,

"ResourceId":  "2017-04-25T16_53_13",

"Properties":  {

"BackupPath":  "\\\\fileshare\backups\NetworkController\\2017-04-25T16_53_13",

"ErrorMessage":  "",

"FailedResourcesList":  [

],

"SuccessfulResourcesList":  [

"/networking/v1/credentials/11ebfc10-438c-4a96-a1ee-8a048ce675be",

"/networking/v1/credentials/41229069-85d4-4352-be85-034d0c5f4658",

"/networking/v1/credentials/b2a82c93-2583-4a1f-91f8-232b801e11bb",

"/networking/v1/credentials/BackupUser",

"/networking/v1/credentials/fd5b1b96-b302-4395-b6cd-ed9703435dd1",

"/networking/v1/virtualNetworkManager/configuration",

"/networking/v1/virtualSwitchManager/configuration",

"/networking/v1/accessControlLists/f8b97a4c-4419-481d-b757-a58483512640",

"/networking/v1/logicalnetworks/24fa1af9-88d6-4cdc-aba0-66e38c1a7bb8",

"/networking/v1/logicalnetworks/48610528-f40b-4718-938e-99c2be76f1e0",

"/networking/v1/logicalnetworks/89035b49-1ee3-438a-8d7a-f93cbae40619",

"/networking/v1/logicalnetworks/a9c8eaa0-519c-4988-acd6-11723e9efae5",

"/networking/v1/logicalnetworks/d4ea002c-c926-4c57-a178-461d5768c31f",

"/networking/v1/macPools/11111111-1111-1111-1111-111111111111",

"/networking/v1/loadBalancerManager/config",

"/networking/v1/publicIPAddresses/2c502b2d-b39a-4be1-a85a-55ef6a3a9a1d",

"/networking/v1/GatewayPools/Default",

"/networking/v1/servers/4c4c4544-0058-5810-8056-b4c04f395931",

"/networking/v1/servers/4c4c4544-0058-5810-8057-b4c04f395931",

"/networking/v1/servers/4c4c4544-0058-5910-8056-b4c04f395931",

"/networking/v1/networkInterfaces/058430d3-af43-4328-a440-56540f41da50",

"/networking/v1/networkInterfaces/08756090-6d55-4dec-98d5-80c4c5a47db8",

"/networking/v1/networkInterfaces/2175d74a-aacd-44e2-80d3-03f39ea3bc5d",

"/networking/v1/networkInterfaces/2400c2c3-2291-4b0b-929c-9bb8da55851a",

"/networking/v1/networkInterfaces/4c695570-6faa-4e4d-a552-0b36ed3e0962",

"/networking/v1/networkInterfaces/7e317638-2914-42a8-a2dd-3a6d966028d6",

"/networking/v1/networkInterfaces/834e3937-f43b-4d3c-88be-d79b04e63bce",

"/networking/v1/networkInterfaces/9d668fe6-b1c6-48fc-b8b1-b3f98f47d508",

"/networking/v1/networkInterfaces/ac4650ac-c3ef-4366-96e7-d9488fb661ba",

"/networking/v1/networkInterfaces/b9f23e35-d79e-495f-a1c9-fa626b85ae13",

"/networking/v1/networkInterfaces/fdd929f1-f64f-4463-949a-77b67fe6d048",

"/networking/v1/virtualServers/15a891ee-7509-4e1d-878d-de0cb4fa35fd",

"/networking/v1/virtualServers/57416993-b410-44fd-9675-727cd4e98930",

"/networking/v1/virtualServers/5f8aebdc-ee5b-488f-ac44-dd6b57bd316a",

"/networking/v1/virtualServers/6c812217-5931-43dc-92a8-1da3238da893",

"/networking/v1/virtualServers/d78b7fa3-812d-4011-9997-aeb5ded2b431",

"/networking/v1/virtualServers/d90820a5-635b-4016-9d6f-bf3f1e18971d",

"/networking/v1/loadBalancerMuxes/5f8aebdc-ee5b-488f-ac44-dd6b57bd316a_suffix",

"/networking/v1/loadBalancerMuxes/d78b7fa3-812d-4011-9997-aeb5ded2b431_suffix",

"/networking/v1/loadBalancerMuxes/d90820a5-635b-4016-9d6f-bf3f1e18971d_suffix",

"/networking/v1/Gateways/15a891ee-7509-4e1d-878d-de0cb4fa35fd_suffix",

"/networking/v1/Gateways/57416993-b410-44fd-9675-727cd4e98930_suffix",

"/networking/v1/Gateways/6c812217-5931-43dc-92a8-1da3238da893_suffix",

"/networking/v1/virtualNetworks/b3dbafb9-2655-433d-b47d-a0e0bbac867a",

"/networking/v1/virtualNetworks/d705968e-2dc2-48f2-a263-76c7892fb143",

"/networking/v1/loadBalancers/24fa1af9-88d6-4cdc-aba0-66e38c1a7bb8_10.127.132.2",

"/networking/v1/loadBalancers/24fa1af9-88d6-4cdc-aba0-66e38c1a7bb8_10.127.132.3",

"/networking/v1/loadBalancers/24fa1af9-88d6-4cdc-aba0-66e38c1a7bb8_10.127.132.4"

],

"InProgressResourcesList":  [

],

"ProvisioningState":  "Succeeded",

"Credential":  {

"Tags":  null,

"ResourceRef":  "/credentials/BackupUser",

"InstanceId":  "00000000-0000-0000-0000-000000000000",

"Etag":  null,

"ResourceMetadata":  null,

"ResourceId":  null,

"Properties":  null

}

}

}

Restore the SDN infrastructure from a backup

When you restore all the necessary components from backup, the SDN environment returns to an operational state.

Important

The steps vary depending on the number of components restored.

  1. If necessary, redeploy Hyper-V hosts and the necessary storage.

  2. If necessary, restore the Network Controller VMs, RAS gateway VMs and Mux VMs from backup.

  3. Stop NC host agent and SLB host agent on all Hyper-V hosts:


stop-service slbhostagent

stop-service nchostagent

  1. Stop RAS Gateway VMs.

  2. Stop SLB Mux VMs.

  3. Restore the Network Controller with the new-networkcontrollerrestore cmdlet.

  4. Check the restore ProvisioningState to know when the restore had completed successfully.

  5. If using SCVMM, restore the SCVMM database using the backup that was created at the same time as the Network Controller backup.

  6. If you want to restore workload VMs from backup, do that now.

  7. Check the health of your system with the debug-networkcontrollerconfigurationstate cmdlet.


$cred = Get-Credential

Debug-NetworkControllerConfigurationState -NetworkController "https://NC.contoso.com" -Credential $cred

Fetching ResourceType:     accessControlLists

Fetching ResourceType:     servers

Fetching ResourceType:     virtualNetworks

Fetching ResourceType:     networkInterfaces

Fetching ResourceType:     virtualGateways

Fetching ResourceType:     loadbalancerMuxes

Fetching ResourceType:     Gateways

Example: Restoring a Network Controller database


$URI = "https://NC.contoso.com"

$Credential = Get-Credential

$ShareUserResourceId = "BackupUser"

$ShareCredential = Get-NetworkControllerCredential -ConnectionURI $URI -Credential $Credential | Where {$_.ResourceId -eq $ShareUserResourceId }

$RestoreProperties = New-Object Microsoft.Windows.NetworkController.NetworkControllerRestoreProperties

$RestoreProperties.RestorePath = "\\fileshare\backups\NetworkController\2017-04-25T16_53_13"

$RestoreProperties.Credential = $ShareCredential

$RestoreTime = (Get-Date).ToString("s").Replace(":", "_")

New-NetworkControllerRestore -ConnectionURI $URI -Credential $Credential -Properties $RestoreProperties -ResourceId $RestoreTime -Force

Example: Checking the status of a Network Controller database restore


PS C:\ > get-networkcontrollerrestore -connectionuri $uri -credential $cred -ResourceId $restoreTime | convertto-json -depth 10

{

"Tags":  null,

"ResourceRef":  "/networkControllerRestore/2017-04-26T15_04_44",

"InstanceId":  "22edecc8-a613-48ce-a74f-0418789f04f6",

"Etag":  "W/\"f14f6b84-80a7-4b73-93b5-59a9c4b5d98e\"",

"ResourceMetadata":  null,

"ResourceId":  "2017-04-26T15_04_44",

"Properties":  {

"RestorePath":  "\\\\sa18fs\\sa18n22\\NetworkController\\2017-04-25T16_53_13",

"ErrorMessage":  null,

"FailedResourcesList":  null,

"SuccessfulResourcesList":  null,

"ProvisioningState":  "Succeeded",

"Credential":  null

}

}

For information on configuration state messages that may appear, see Troubleshoot the Windows Server 2016 Software Defined Networking Stack.