Get-AzBastionShareableLink

The Bastion Shareable Link feature lets users connect to a target resource (virtual machine or virtual machine scale set) using Azure Bastion without accessing the Azure portal.

Syntax

Get-AzBastionShareableLink
   -ResourceGroupName <String>
   -Name <String>
   [-TargetVmId <System.Collections.Generic.List`1[System.String]>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Get-AzBastionShareableLink
   -ResourceId <String>
   [-TargetVmId <System.Collections.Generic.List`1[System.String]>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Get-AzBastionShareableLink
   -InputObject <PSBastion>
   [-TargetVmId <System.Collections.Generic.List`1[System.String]>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Return the Bastion Shareable Links for all the VMs specified in the request.

Examples

Example 1

Get-AzBastionShareableLink -ResourceGroupName $RgName -Name $bastionName

{
  "vm": {
    "id": "/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm"
  },
  "bsl": "http://bst-bastionhostid.bastion.com/api/shareable-url/tokenvm",
  "createdAt": "2019-10-17T12:00:00.0000Z"
}

Example 2

Get-AzBastionShareableLink -InputObject $bastion -TargetVmId $vm1.Id

{
  "vm": {
    "id": "/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm1"
  },
  "bsl": "http://bst-bastionhostid.bastion.com/api/shareable-url/tokenvm1",
  "createdAt": "2019-10-17T12:00:00.0000Z"
}

Gets shareable link(s) for specified VMs on a Bastion resource.

Parameters

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Bastion Object

Type:PSBastion
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

The Bastion resource name.

Type:String
Aliases:ResourceName, BastionName
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The resource group name where Bastion resource exists

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceId

The Bastion Resource ID

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-TargetVmId

ID of the VMs to get Bastion shareable links

Type:List<T>[String]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

List<T>[[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

SwitchParameter

Outputs

List<T>[[Microsoft.Azure.Commands.Network.Models.Bastion.PSBastionShareableLink, Microsoft.Azure.PowerShell.Cmdlets.Network, Version=7.5.0.0, Culture=neutral, PublicKeyToken=null]]