< Back

New-AzureRmResource

Tue Jan 29, 2019 10:05 pm

NAME New-AzureRmResource



SYNOPSIS

Creates a resource.





SYNTAX

New-AzureRmResource [-ApiVersion <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-ExtensionResourceName <String>]

[-ExtensionResourceType <String>] [-Force] [-IsFullObject] [-Kind <String>] [-Location <String>] [-ODataQuery <String>] [-Plan <Hashtable>] [-Pre]

[-Properties <PSObject>] [-ResourceGroupName <String>] -ResourceName <String> -ResourceType <String> [-Sku <Hashtable>] [-Tag <Hashtable>]

[-Confirm] [-WhatIf] [<CommonParameters>]



New-AzureRmResource [-ApiVersion <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-ExtensionResourceName <String>]

[-ExtensionResourceType <String>] [-Force] [-IsFullObject] [-Kind <String>] [-Location <String>] [-ODataQuery <String>] [-Plan <Hashtable>] [-Pre]

[-Properties <PSObject>] -ResourceName <String> -ResourceType <String> [-Sku <Hashtable>] [-Tag <Hashtable>] -TenantLevel [-Confirm] [-WhatIf]

[<CommonParameters>]



New-AzureRmResource [-ApiVersion <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-Force] [-IsFullObject] [-Kind <String>]

[-Location <String>] [-ODataQuery <String>] [-Plan <Hashtable>] [-Pre] [-Properties <PSObject>] -ResourceId <String> [-Sku <Hashtable>] [-Tag

<Hashtable>] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The New-AzureRmResource cmdlet creates an Azure resource, such as a website, Azure SQL Database server, or Azure SQL Database, in a resource group.





PARAMETERS

-ApiVersion <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-AsJob [<SwitchParameter>]

Run cmdlet in the background



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ExtensionResourceName <String>

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



server name`/`database name



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ExtensionResourceType <String>

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



`Microsoft.Sql/Servers/Databases`



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Force [<SwitchParameter>]

Forces the command to run without asking for user confirmation.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-IsFullObject [<SwitchParameter>]

Indicates that the object that the Properties parameter specifies is the full object.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Kind <String>

Specifies the resource kind for the resource.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Location <String>

Specifies the location of the resource. Specify data center location, such as Central US or Southeast Asia.



You can place a resource in any location that supports resources of that type. Resource groups can contain resources from different locations.

To determine which locations support each resource type, use the Get-AzureLocation cmdlet.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ODataQuery <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Plan <Hashtable>

A hash table that represents resource plan properties.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Pre [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Properties <PSObject>

Specifies resource properties for the resource. Use this parameter to specify the values of properties that are specific to a resource type.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ResourceGroupName <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ResourceId <String>

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



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



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ResourceName <String>

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



`ContosoServer/ContosoDatabase`



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ResourceType <String>

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



`Microsoft.Sql/Servers/Databases`



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Sku <Hashtable>

A hash table that represents sku properties.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Tag <Hashtable>

Key-value pairs in the form of a hash table. For example:



@{key0="value0";key1=$null;key2="value2"}



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-TenantLevel [<SwitchParameter>]

Indicates that this cmdlet operates at the tenant level.



Required? true

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

System.Management.Automation.PSObject







NOTES









Example 1: Create a resource



PS> New-AzureRmResource -Location "West US" -Properties @{test="test"} -ResourceName TestSite06 -ResourceType microsoft.web/sites

-ResourceGroupName ResourceGroup11 -Force



This command creates a resource that is a website in ResourceGroup11.





Example 2: Create a resource using splatting



PS> $prop = @{

Location = "West US"

Properties = @{test = "test"}

ResourceName = "TestSite06"

ResourceType = "microsoft.web/sites"

ResourceGroupName = "ResourceGroup11"

Force = $true

}



PS> New-AzureRmResource @prop



This command creates a resource that is a website in ResourceGroup11.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... rmresource

Find-AzureRmResource

Get-AzureRmResource

Move-AzureRmResource

Remove-AzureRmResourceGroup

Set-AzureRmResourceGroup