Get-AzureStorSimpleResourceContext

Gets the current resource context.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Service Management APIs. See the Az PowerShell module for cmdlets to manage Azure Resource Manager resources.

Syntax

Get-AzureStorSimpleResourceContext
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

The Get-AzureStorSimpleResourceContext cmdlet gets the current resource context.

Examples

Example 1: Get the current context

PS C:\>Select-AzureStorSimpleResource -ResourceName "Contoso63-Tsqa" 
PS C:\> Get-AzureStorSimpleResourceContext
ResourceId           ResourceName
----------           ------------
1909806764156522689  Contoso63-Tsqa

The first command sets the current context to be the resource named Contoso63-Tsqa by using the Select-AzureStorSimpleResource cmdlet.

The second command gets the current resource context.

Example 2: Attempt to get the current context

PS C:\>Get-AzureStorSimpleResourceContext
Get-AzureStorSimpleResourceContext : Resource Context is not set for your subscription. Please use
Select-AzureStorSimpleResource -ResourceName <<name>> to set

This command gets the current context. In this example, no context has been set. The command returns a message that explains the problem.

Parameters

-Profile

Specifies an Azure profile.

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

Inputs

None

Outputs

StorSimpleResourceContext

This cmdlet returns a ResourceContext object.