Powershell Microsoft Edge



  1. Azure Stack Edge Pro solution lets you process data and send it over the network to Azure. This article describes some of the configuration and management tasks for your Azure Stack Edge Pro device. You can use the Azure portal, local web UI, or the Windows PowerShell interface to manage your device.
  2. Microsoft Edge (new Edge, based on Chromium) Scripts. Scripts for (new) Microsoft Edge (based on Chromium): Backup Favorites / Bookmarks, Modify Settings. Backup-Script for Edge Bookmarks (Favorites) into an HTML File. PowerShell-Script EdgeChromium-Bookmarks-Backup-JSON-to-HTML.ps1.
  3. PowerShell is a task-based command-line shell and scripting language built on.NET. PowerShell helps system administrators and power-users rapidly automate task that manage operating systems (Linux, macOS, and Windows) and processes. PowerShell commands let you manage computers from the command line.

Automatic Edge Chromium installer for PowerShell 2. This works in an OOB install of Windows 7 and is also compatible with Windows 10 and PowerShell 5.1. I did incorporate a JSON parser function posted elsewhere online. Unfortunately, I don't remember where I got it.

-->

APPLIES TO: Azure Stack Edge Pro - GPUAzure Stack Edge Pro RAzure Stack Edge Mini R

This article describes how to create and manage a virtual machine (VM) on your Azure Stack Edge device by using Azure PowerShell. The information applies to Azure Stack Edge Pro with GPU (graphical processing unit), Azure Stack Edge Pro R, and Azure Stack Edge Mini R devices.

VM deployment workflow

The deployment workflow is displayed in the following diagram:

Prerequisites

Before you can deploy VMs on your Azure Stack Edge device, you must configure your client to connect to the device via Azure Resource Manager over Azure PowerShell. For detailed instructions, see Connect to Azure Resource Manager on your Azure Stack Edge device.

Make sure that you can use the following steps to access the device from your client. You've already done this configuration when you connected to Azure Resource Manager, and now you're verifying that the configuration was successful.

  1. Verify that Azure Resource Manager communication is working by running the following command:

  2. To call the local device APIs to authenticate, enter:

    login-AzureRMAccount -EnvironmentName <Environment Name> -TenantId c0257de7-538f-415c-993a-1b87a031879d

    To connect via Azure Resource Manager, provide the username EdgeArmUser and your password.

  3. If you configured compute for Kubernetes, you can skip this step. Otherwise, ensure that you've enabled a network interface for compute by doing the following:

    a. On your local user interface, go to Compute settings.
    b. Select the network interface that you want to use to create a virtual switch. The VMs you create will be attached to a virtual switch that's attached to this port and the associated network. Be sure to choose a network that matches the IP address you'll use for the VM.

    c. Under Enable for compute on the network interface, select Yes. Azure Stack Edge will create and manage a virtual switch that corresponds to that network interface. Don't enter specific IPs for Kubernetes at this time. It can take several minutes to enable compute.

    Note

    If you're creating GPU VMs, select a network interface that's connected to the internet. Doing so enables you to install a GPU extension on your device.

Query for a built-in subscription on the device

For Azure Resource Manager, only a single fixed subscription that's user-visible is supported. This subscription is unique per device, and the subscription name and subscription ID can't be changed.

The subscription contains all the resources that are required for VM creation.

Important

The subscription is created when you enable VMs from the Azure portal, and it lives locally on your device.

The subscription is used to deploy the VMs.

  1. To list the subscription, run the following command:

    Here's some example output:

  2. Get a list of the registered resource providers that are running on the device. The list ordinarily includes compute, network, and storage.

    Note

    The resource providers are pre-registered, and they can't be modified or changed.

    Here's some example output:

Create a resource group

Create an Azure resource group with New-AzureRmResourceGroup. A resource group is a logical container into which Azure resources, such as a storage account, disk, and managed disk, are deployed and managed.

Important

All the resources are created in the same location as that of the device, and the location is set to DBELocal.

Here's some example output:

Create a storage account

Create a new storage account by using the resource group that you created in the preceding step. This is a local storage account that you use to upload the virtual disk image for the VM.

Note

By using Azure Resource Manager, you can create only local storage accounts, such as locally redundant storage (standard or premium). To create tiered storage accounts, see Tutorial: Transfer data via storage accounts with Azure Stack Edge Pro with GPU.

Here's some example output:

To get the storage account key, run the Get-AzureRmStorageAccountKey command. Here's some example output:

Add the blob URI to the host file

You already added the blob URI in the hosts file for the client that you're using to connect to Azure Blob Storage in 'Step 5: Modify host file for endpoint name resolution' of Deploy VMs on your Azure Stack Edge device via Azure PowerShell. This entry was used to add the blob URI:

<Azure consistent network services VIP > <storage name>.blob.<appliance name>.<dnsdomain>

Install certificates

If you're using HTTPS, you need to install the appropriate certificates on your device. Here, you install the blob endpoint certificate. For more information, see Use certificates with your Azure Stack Edge Pro with GPU device.

Upload a VHD

Copy any disk images to be used into page blobs in the local storage account that you created earlier. You can use a tool such as AzCopy to upload the virtual hard disk (VHD) to the storage account.

Use the following commands with AzCopy 10:

Here's some example output:

Create a managed disk from the VHD

To create a managed disk from the uploaded VHD, run the following command:

Here's some example output:

$DiskConfig = New-AzureRmDiskConfig -Location DBELocal -CreateOption Import –SourceUri http://sa191113014333.blob.dbe-1dcmhq2.microsoftdatabox.com/vmimages/ubuntu13.vhd

Here's some example output. For more information about this cmdlet, see New-AzureRmDisk.

Create a VM image from the image managed disk

To create a VM image from the managed disk, run the following command. Replace <Disk name>, <OS type>, and <Disk size> with real values.

Here's some example output. For more information about this cmdlet, see New-AzureRmImage.

Create your VM with previously created resources

Before you create and deploy the VM, you must create one virtual network and associate a virtual network interface with it.

Important

The following rules apply:

  • You can create only one virtual network, even across resource groups. The virtual network must have exactly the same address space as the logical network.
  • The virtual network can have only one subnet. The subnet must have exactly the same address space as the virtual network.
  • When you create the virtual network interface card, you can use only the static allocation method. The user needs to provide a private IP address.

Query the automatically created virtual network

When you enable compute from the local UI of your device, a virtual network called ASEVNET is created automatically, under the ASERG resource group.

Powershell Microsoft Edge

Use the following command to query the existing virtual network:

Create a virtual network interface card

To create a virtual network interface card by using the virtual network subnet ID, run the following command:

Here's some example output:

Optionally, while you're creating a virtual network interface card for a VM, you can pass the public IP. In this instance, the public IP returns the private IP.

Create a VM

You can now use the VM image to create a VM and attach it to the virtual network that you created earlier.

After you've created and powered up the VM, you'll use the following username and password to sign in to it.

Connect to the VM

Depending on whether you created a Windows VM or a Linux VM, the connection instructions can be different.

Connect to a Linux VM

To connect to a Linux VM, do the following:

Connect to the VM by using the private IP that you passed during the VM creation.

  1. Open an SSH session to connect with the IP address.

    ssh -l <username> <ip address>

  2. At the prompt, provide the password that you used when you created the VM.

    If you need to provide the SSH key, use this command.

    ssh -i c:/users/Administrator/.ssh/id_rsa Administrator@5.5.41.236

    Here's an example output when you connect to the VM:

  3. If you used a public IP address during the VM creation, you can use that IP to connect to the VM. To get the public IP, run the following command:

    In this instance, the public IP is the same as the private IP that you passed during the creation of the virtual network interface.

Connect to a Windows VM

To connect to a Windows VM, do the following:

Connect to your Windows VM by using the Remote Desktop Protocol (RDP) via the IP that you passed during the VM creation.

  1. On your client, open RDP.

  2. Go to Start, and then type mstsc.

  3. On the Remote Desktop Connection pane, enter the IP address of the VM and the access credentials you used in the VM template parameters file, and then select Connect.

    Note

    You might need to approve connecting to an untrusted machine.

You’re now signed in to your VM that runs on the appliance.

Manage the VM

The following sections describe some of the common operations that you can create on your Azure Stack Edge Pro device.

List VMs that are running on the device

To return a list of all the VMs that are running on your Azure Stack Edge device, run this command:

Get-AzureRmVM -ResourceGroupName <String> -Name <String>

Turn on the VM

To turn on a virtual machine that's running on your device, run the following cmdlet:

Start-AzureRmVM [-Name] <String> [-ResourceGroupName] <String>

For more information about this cmdlet, see Start-AzureRmVM.

Suspend or shut down the VM

To stop or shut down a virtual machine that's running on your device, run the following cmdlet:

For more information about this cmdlet, see Stop-AzureRmVM cmdlet.

Add a data disk

If the workload requirements on your VM increase, you might need to add a data disk. To do so, run the following command:

Delete the VM

To remove a virtual machine from your device, run the following cmdlet:

For more information about this cmdlet, see Remove-AzureRmVm cmdlet.

Next steps

Powershell microsoft edge-->

APPLIES TO: Azure Stack Edge Pro - GPUAzure Stack Edge Pro RAzure Stack Edge Mini R

Azure Stack Edge Pro solution lets you process data and send it over the network to Azure. This article describes some of the configuration and management tasks for your Azure Stack Edge Pro device. You can use the Azure portal, local web UI, or the Windows PowerShell interface to manage your device.

This article focuses on how you can connect to the PowerShell interface of the device and the tasks you can do using this interface.

Connect to the PowerShell interface

Depending on the operating system of client, the procedures to remotely connect to the device are different.

Remotely connect from a Windows client

Prerequisites

Before you begin, make sure that:

  • Your Windows client is running Windows PowerShell 5.0 or later.

  • Your Windows client has the signing chain (root certificate) corresponding to the node certificate installed on the device. For detailed instructions, see Install certificate on your Windows client.

  • The hosts file located at C:WindowsSystem32driversetc for your Windows client has an entry corresponding to the node certificate in the following format:

    <Device IP> <Node serial number>.<DNS domain of the device>

    Here is an example entry for the hosts file:

    10.100.10.10 1HXQG13.wdshcsso.com

Detailed steps

Follow these steps to remotely connect from a Windows client.

  1. Run a Windows PowerShell session as an administrator.

  2. Make sure that the Windows Remote Management service is running on your client. At the command prompt, type:

    winrm quickconfig

    For more information, see Installation and configuration for Windows Remote Management.

  3. Assign a variable to the device IP address.

    $ip = '<device_ip>'

    Replace <device_ip> with the IP address of your device.

  4. To add the IP address of your device to the client’s trusted hosts list, type the following command:

    Set-Item WSMan:localhostClientTrustedHosts $ip -Concatenate -Force

  5. Start a Windows PowerShell session on the device:

    Enter-PSSession -ComputerName $ip -Credential $ipEdgeUser -ConfigurationName Minishell -UseSSL

    If you see an error related to trust relationship, then check if the signing chain of the node certificate uploaded to your device is also installed on the client accessing your device.

    If you are not using the certificates (we recommend that you use the certificates!), you can skip this check by using the session options: -SkipCACheck -SkipCNCheck -SkipRevocationCheck.

    Note

    When you use the -UseSSL option, you are remoting via PowerShell over https. We recommend that you always use https to remotely connect via PowerShell.

  6. Provide the password when prompted. Use the same password that is used to sign into the local web UI. The default local web UI password is Password1. When you successfully connect to the device using remote PowerShell, you see the following sample output:

Important

In the current release, you can connect to the PowerShell interface of the device only via a Windows client. The -UseSSL option does not work with the Linux clients.

Create a support package

If you experience any device issues, you can create a support package from the system logs. Microsoft Support uses this package to troubleshoot the issues. Follow these steps to create a support package:

  1. Connect to the PowerShell interface of your device.

  2. Use the Get-HcsNodeSupportPackage command to create a support package. The usage of the cmdlet is as follows:

    The cmdlet collects logs from your device and copies those logs to a specified network or local share.

    The parameters used are as follows:

    • -Path - Specify the network or the local path to copy support package to. (required)
    • -Credential - Specify the credentials to access the protected path.
    • -Zip - Specify to generate a zip file.
    • -Include - Specify to include the components to be included in the support package. If not specified, Default is assumed.
    • -IncludeArchived - Specify to include archived logs in the support package.
    • -IncludePeriodicStats - Specify to include periodic stat logs in the support package.

Install Microsoft Edge Powershell

View device information

  1. Connect to the PowerShell interface.

  2. Use the Get-HcsApplianceInfo to get the information for your device.

    The following example shows the usage of this cmdlet:

    Here is a table summarizing some of the important device information:

    ParameterDescription
    FriendlyNameThe friendly name of the device as configured through the local web UI during device deployment. The default friendly name is the device serial number.
    SerialNumberThe device serial number is a unique number assigned at the factory.
    ModelThe model for your Azure Stack Edge or Data Box Gateway device. The model is physical for Azure Stack Edge and virtual for Data Box Gateway.
    FriendlySoftwareVersionThe friendly string that corresponds to the device software version. For a system running preview, the friendly software version would be Data Box Edge 1902.
    HcsVersionThe HCS software version running on your device. For instance, the HCS software version corresponding to Data Box Edge 1902 is 1.4.771.324.
    LocalCapacityInMbThe total local capacity of the device in Megabits.
    IsRegisteredThis value indicates if your device is activated with the service.

Powershell Microsoft Edge Version

View GPU driver information

If the compute role is configured on your device, you can also get the GPU driver information via the PowerShell interface.

  1. Connect to the PowerShell interface.

  2. Use the Get-HcsGpuNvidiaSmi to get the GPU driver information for your device.

    The following example shows the usage of this cmdlet:

    Make a note of the driver information from the sample output of this cmdlet.

Enable Multi-Process Service (MPS)

A Multi-Process Service (MPS) on Nvidia GPUs provides a mechanism where GPUs can be shared by multiple jobs, where each job is allocated some percentage of the GPU's resources. MPS is a preview feature on your Azure Stack Edge Pro GPU device. To enable MPS on your device, follow these steps:

  1. Before you begin, make sure that:

    1. You've configured and Activated your Azure Stack Edge Pro device with an Azure Stack Edge resource in Azure.
    2. You've Configured compute on this device in the Azure portal.
  2. Connect to the PowerShell interface.

  3. Use the following command to enable MPS on your device.

Note

When the device software and the Kubernetes cluster are updated, the MPS setting is not retained for the workloads. You'll need to enable MPS again.

Reset your device

To reset your device, you need to securely wipe out all the data on the data disk and the boot disk of your device.

Use the Reset-HcsAppliance cmdlet to wipe out both the data disks and the boot disk or just the data disks. The ClearData and BootDisk switches allow you to wipe the data disks and the boot disk respectively.

The BootDisk switch wipes the boot disk and makes the device unusable. It should be used only when the device needs to be returned to Microsoft. For more information, see Return the device to Microsoft.

If you use the device reset in the local web UI, only the data disks are securely wiped but the boot disk is kept intact. The boot disk contains the device configuration.

  1. Connect to the PowerShell interface.

  2. At the command prompt, type:

    Reset-HcsAppliance -ClearData -BootDisk

    The following example shows how to use this cmdlet:

Get compute logs

If the compute role is configured on your device, you can also get the compute logs via the PowerShell interface.

  1. Connect to the PowerShell interface.

  2. Use the Get-AzureDataBoxEdgeComputeRoleLogs to get the compute logs for your device.

    The following example shows the usage of this cmdlet:

    Here is a description of the parameters used for the cmdlet:

    • Path: Provide a network path to the share where you want to create the compute log package.
    • Credential: Provide the username for the network share. When you run this cmdlet, you will need to provide the share password.
    • FullLogCollection: This parameter ensures that the log package will contain all the compute logs. By default, the log package contains only a subset of logs.

Change Kubernetes pod and service subnets

By default, Kubernetes on your Azure Stack Edge device uses subnets 172.27.0.0/16 and 172.28.0.0/16 for pod and service respectively. If these subnets are already in use in your network, then you can run the Set-HcsKubeClusterNetworkInfo cmdlet to change these subnets.

You want to perform this configuration before you configure compute from the Azure portal as the Kubernetes cluster is created in this step.

  1. Connect to the PowerShell interface of the device.

  2. From the PowerShell interface of the device, run:

    Set-HcsKubeClusterNetworkInfo -PodSubnet <subnet details> -ServiceSubnet <subnet details>

    Replace the with the subnet range that you want to use.

  3. Once you have run this command, you can use the Get-HcsKubeClusterNetworkInfo command to verify that the pod and service subnets have changed.

Here is a sample output for this command.

Debug Kubernetes issues related to IoT Edge

Before you begin, you must have:

  • Compute network configured. See Tutorial: Configure network for Azure Stack Edge Pro with GPU.
  • Compute role configured on your device.

On an Azure Stack Edge Pro device that has the compute role configured, you can troubleshoot or monitor the device using two different sets of commands.

  • Using iotedge commands. These commands are available for basic operations for your device.
  • Using kubectl commands. These commands are available for an extensive set of operations for your device.

To execute either of the above set of commands, you need to Connect to the PowerShell interface.

Use iotedge commands

To see a list of available commands, connect to the PowerShell interface and use the iotedge function.

The following table has a brief description of the commands available for iotedge:

commandDescription
listList modules
logsFetch the logs of a module
restartStop and restart a module

List all IoT Edge modules

To list all the modules running on your device, use the iotedge list command.

Here is a sample output of this command. This command lists all the modules, associated configuration, and the external IPs associated with the modules. For example, you can access the webserver app at https://10.128.44.244.

Restart modules

You can use the list command to list all the modules running on your device. Then identify the name of the module that you want to restart and use it with the restart command.

Here is a sample output of how to restart a module. Based on the description of how long the module is running for, you can see that cuda-sample1 was restarted.

Get module logs

Use the logs command to get logs for any IoT Edge module running on your device.

If there was an error in creation of the container image or while pulling the image, run logs edgeagent. edgeagent is the IoT Edge runtime container that is responsible for provisioning other containers. Because logs edgeagent dumps all the logs, a good way to see the recent errors is to use the option --tail 0`.

Here is a sample output.

Reinstall

Use kubectl commands

On an Azure Stack Edge Pro device that has the compute role configured, all the kubectl commands are available to monitor or troubleshoot modules. To see a list of available commands, run kubectl --help from the command window.

For a comprehensive list of the kubectl commands, go to kubectl cheatsheet.

To get IP of service or module exposed outside of Kubernetes cluster

To get the IP of a load-balancing service or modules exposed outside of the Kubernetes, run the following command:

kubectl get svc -n iotedge

Following is a sample output of the all the services or modules that are exposed outside of the Kubernetes cluster.

The IP address in the External IP column corresponds to the external endpoint for the service or the module. You can also Get the external IP in the Kubernetes dashboard.

To check if module deployed successfully

Compute modules are containers that have a business logic implemented. A Kubernetes pod can have multiple containers running.

To check if a compute module is deployed successfully, connect to the PowerShell interface of the device.Run the get pods command and check if the container (corresponding to the compute module) is running.

To get the list of all the pods running in a specific namespace, run the following command:

Powershell Microsoft Edge

get pods -n <namespace>

To check the modules deployed via IoT Edge, run the following command:

get pods -n iotedge

Following is a sample output of all the pods running in the iotedge namespace.

The status Status indicates that all the pods in the namespace are running and the Ready indicates the number of containers deployed in a pod. In the preceding sample, all the pods are running and all the modules deployed in each of the pods are running.

To check the modules deployed via Azure Arc, run the following command:

get pods -n azure-arc

Alternatively, you can Connect to Kubernetes dashboard to see IoT Edge or Azure Arc deployments.

For a more verbose output of a specific pod for a given namespace, you can run the following command:

kubectl describe pod <pod name> -n <namespace>

Powershell Commands For Edge

The sample output is shown here.

To get container logs

To get the logs for a module, run the following command from the PowerShell interface of the device:

kubectl logs <pod_name> -n <namespace> --all-containers

Because all-containers flag dumps all the logs for all the containers, a good way to see the recent errors is to use the option --tail 10.

Following is a sample output.

Change memory, processor limits for Kubernetes worker node

To change the memory or processor limits for Kubernetes worker node, do the following steps:

Powershell Microsoft Edge Com Object

  1. Connect to the PowerShell interface of the device.

  2. To get the current resources for the worker node and the role options, run the following command:

    Get-AzureDataBoxEdgeRole

    Here is a sample output. Note the values for Name and Compute under Resources section. MemoryInBytes and ProcessorCount denote the currently assigned values memory and processor count for the Kubernetes worker node.

  3. To change the values of memory and processors for the worker node, run the following command:

    Set-AzureDataBoxEdgeRoleCompute -Name -Memory -ProcessorCount <No. of cores>

    Here is a sample output.

While changing the memory and processor usage, follow these guidelines.

  • Default memory is 25% of device specification.
  • Default processor count is 30% of device specification.
  • When changing the values for memory and processor counts, we recommend that you vary the values between 15% to 60% of the device memory and the processor count.
  • We recommend an upper limit of 60% is so that there are enough resources for system components.

Connect to BMC

Baseboard management controller (BMC) is used to remotely monitor and manage your device. This section describes the cmdlets that can be used to manage BMC configuration. Prior to running any of these cmdlets, Connect to the PowerShell interface of the device.

  • Get-HcsNetBmcInterface: Use this cmdlet to get the network configuration properties of the BMC, for example, IPv4Address, IPv4Gateway, IPv4SubnetMask, DhcpEnabled.

    Here is a sample output:

  • Set-HcsNetBmcInterface: You can use this cmdlet in the following two ways.

    • Use the cmdlet to enable or disable DHCP configuration for BMC by using the appropriate value for UseDhcp parameter.

      Here is a sample output:

    • Use this cmdlet to configure the static configuration for the BMC. You can specify the values for IPv4Address, IPv4Gateway, and IPv4SubnetMask.

      Here is a sample output:

  • Set-HcsBmcPassword: Use this cmdlet to modify the BMC password for EdgeUser. The user name - EdgeUser- is case-sensitive.

    Here is a sample output:

Exit the remote session

To exit the remote PowerShell session, close the PowerShell window.

Next steps

  • Deploy Azure Stack Edge Pro in Azure portal.