Set-​Azure​Rm​Resource

Modifies a resource.

Syntax

Set-AzureRmResource
   [-ApiVersion <String>]
   [-ExtensionResourceName <String>]
   [-ExtensionResourceType <String>]
   [-Force]
   [-Kind <String>]
   [-ODataQuery <String>]
   [-Plan <Hashtable>]
   [-Pre]
   [-Properties <PSObject>]
   [-ResourceGroupName <String>]
   -ResourceName <String>
   -ResourceType <String>
   [-Sku <Hashtable>]
   [-Tag <Hashtable>]
   [-UsePatchSemantics]
   [-Confirm]
   [-WhatIf]
   [<CommonParameters>]
Set-AzureRmResource
   [-ApiVersion <String>]
   [-ExtensionResourceName <String>]
   [-ExtensionResourceType <String>]
   [-Force]
   [-Kind <String>]
   [-ODataQuery <String>]
   [-Plan <Hashtable>]
   [-Pre]
   [-Properties <PSObject>]
   -ResourceName <String>
   -ResourceType <String>
   [-Sku <Hashtable>]
   [-Tag <Hashtable>]
   [-TenantLevel]
   [-UsePatchSemantics]
   [-Confirm]
   [-WhatIf]
   [<CommonParameters>]
Set-AzureRmResource
   [-ApiVersion <String>]
   [-Force]
   [-Kind <String>]
   [-ODataQuery <String>]
   [-Plan <Hashtable>]
   [-Pre]
   [-Properties <PSObject>]
   -ResourceId <String>
   [-Sku <Hashtable>]
   [-Tag <Hashtable>]
   [-UsePatchSemantics]
   [-Confirm]
   [-WhatIf]
   [<CommonParameters>]

Description

The Set-AzureRmResource cmdlet modifies an existing Azure resource. Specify a resource to modify by name and type or by ID.

Examples

Example 1: Modify a resource

PS C:\>$Resource = Get-AzureRmResource -ResourceType "microsoft.web/sites" -ResourceGroupName "ResourceGroup11" -ResourceName "ContosoSite" 
PS C:\> $Resource.Properties.Enabled = "False"
PS C:\> $Resource | Set-AzureRmResource -Force

The first command gets the resource named ContosoSite by using the Get-AzureRmResource cmdlet, and then stores it in the $Resource variable.

The second command modifies a property of $Resource.

The final command updates the resource to match $Resource.

Required Parameters

-ResourceId

Specifies the fully qualified resource ID, including the subscription, as in the following example:

/subscriptions/subscription ID/providers/Microsoft.Sql/servers/ContosoServer/databases/ContosoDatabase

Type:String
Aliases:Id
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceName

Specifies the name of the resource. For instance, to specify a database, use the following format:

ContosoServer/ContosoDatabase

Type:String
Aliases:Name
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceType

Specifies the type of the resource. For instance, for a database, the resource type is as follows:

Microsoft.Sql/Servers/Databases

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TenantLevel

Indicates that this cmdlet operates at the tenant level.

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

Optional Parameters

-ApiVersion

Specifies the version of the resource provider API to use. If you do not specify a version, this cmdlet uses the latest available version.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-ExtensionResourceName

Specifies the name of an extension resource for the resource. For instance, to specify a database, use the following format:

server name/database name

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ExtensionResourceType

Specifies the resource type for an extension resource. For instance, if the extension resource is a database specify the following:

Microsoft.Sql/Servers/Databases

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Kind

Specifies the resource kind for the resource.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ODataQuery

Specifies an Open Data Protocol (OData) style filter. This cmdlet appends this value to the request in addition to any other filters.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Plan

Specifies resource plan properties, as a hash table, for the resource.

Type:Hashtable
Aliases:PlanObject
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Pre

Indicates that this cmdlet considers pre-release API versions when it automatically determines which version to use.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Properties

Specifies resource properties for the resource.

Type:PSObject
Aliases:PropertyObject
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of the resource group where this cmdlet modifies the resource.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Sku

Specifies the SKU object of the resource as a hash table.

Type:Hashtable
Aliases:SkuObject
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Tag

Specifies resource tags as an array of hash tables.

Type:Hashtable
Aliases:Tags
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-UsePatchSemantics

Indicates that this cmdlet uses an HTTP PATCH to update the object, instead of an HTTP PUT.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
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:False
Accept pipeline input:False
Accept wildcard characters:False