Shaun Luttin
Shaun Luttin

Reputation: 141712

What do we put in the Get-AzureResource -ApiVersion parameter?

I am trying to get a specific Microsoft Azure Website resource, so that I can change some of its properties. To get a single resource, Get-AzureResource requires the ApiVersion property. Where do I find this?

Parameter Set: Get a single resource

Get-AzureResource 
    [-Name] <String> 
    -ApiVersion <String> 
    -ResourceGroupName <String> 
    -ResourceType <String> 
    [-ParentResource <String> ] 
    [ <CommonParameters>]

See http://msdn.microsoft.com/en-us/library/dn654579.aspx

Upvotes: 2

Views: 2117

Answers (2)

Pradebban Raja
Pradebban Raja

Reputation: 463

Here is how to get a particular website Resource details.

Switch-AzureMode -Name AzureResourceManager

$website = Get-AzureResource -ResourceType "Microsoft.Web/sites" | where {$_.Name -eq "<*YOURWEBSITENAME*>"}

$websiteName = $website.Name

$websiteResource = $website.ParentResource

$websiteResourceId = $website.ResourceId

Upvotes: 3

Shaun Luttin
Shaun Luttin

Reputation: 141712

I found the answer here.

Run the following in PowerShell.

$DebugPreference='Continue'
Get-AzureResourceGroup

The debug output will start like this:

DEBUG: 5:25:10 PM - GetAzureResourceGroupCommand begin processing with ParameterSet 'GetMultiple'.
DEBUG: 5:25:10 PM - using account id '[email protected]'...
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://management.azure.com/subscriptions/12345678-1234-1234-1234-1234567890ab/providers/microsoft.batch/register?api-version=2014-04-01-preview

Inspect the Absolute Uri - the query string parameter is api-version.

  • https://management.azure.com/
  • subscriptions/
  • 12345678-1234-1234-1234-1234567890ab/
  • providers/
  • microsoft.batch/
  • register?
  • api-version=2014-04-01-preview

Where you're done, run the following in PowerShell to stop the debug output.

$DebugPreference='SilentlyContinue'

Upvotes: 4

Related Questions