Redigera

Dela via


New-AzReservation

Purchase ReservationOrder and create resource under the specified URI.

Syntax

New-AzReservation
   -ReservationOrderId <String>
   [-AppliedScope <String[]>]
   [-AppliedScopePropertyDisplayName <String>]
   [-AppliedScopePropertyManagementGroupId <String>]
   [-AppliedScopePropertyResourceGroupId <String>]
   [-AppliedScopePropertySubscriptionId <String>]
   [-AppliedScopePropertyTenantId <String>]
   [-AppliedScopeType <AppliedScopeType>]
   [-BillingPlan <ReservationBillingPlan>]
   [-BillingScopeId <String>]
   [-DisplayName <String>]
   [-InstanceFlexibility <InstanceFlexibility>]
   [-Location <String>]
   [-Quantity <Int32>]
   [-Renew]
   [-ReservedResourceType <ReservedResourceType>]
   [-ReviewDateTime <DateTime>]
   [-Sku <String>]
   [-Term <ReservationTerm>]
   [-DefaultProfile <PSObject>]
   [-AsJob]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzReservation
   -ReservationOrderId <String>
   -Body <IPurchaseRequest>
   [-DefaultProfile <PSObject>]
   [-AsJob]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzReservation
   -InputObject <IReservationsIdentity>
   [-AppliedScope <String[]>]
   [-AppliedScopePropertyDisplayName <String>]
   [-AppliedScopePropertyManagementGroupId <String>]
   [-AppliedScopePropertyResourceGroupId <String>]
   [-AppliedScopePropertySubscriptionId <String>]
   [-AppliedScopePropertyTenantId <String>]
   [-AppliedScopeType <AppliedScopeType>]
   [-BillingPlan <ReservationBillingPlan>]
   [-BillingScopeId <String>]
   [-DisplayName <String>]
   [-InstanceFlexibility <InstanceFlexibility>]
   [-Location <String>]
   [-Quantity <Int32>]
   [-Renew]
   [-ReservedResourceType <ReservedResourceType>]
   [-ReviewDateTime <DateTime>]
   [-Sku <String>]
   [-Term <ReservationTerm>]
   [-DefaultProfile <PSObject>]
   [-AsJob]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzReservation
   -InputObject <IReservationsIdentity>
   -Body <IPurchaseRequest>
   [-DefaultProfile <PSObject>]
   [-AsJob]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Purchase ReservationOrder and create resource under the specified URI.

Examples

Example 1: Create a new reservation

New-AzReservation -AppliedScopeType 'Shared' -BillingPlan 'Upfront' -billingScopeId '/subscriptions/b0f278e1-1f18-4378-84d7-b44dfa708665' -DisplayName 'TestVm2222' -Location 'westus' -Quantity 1 -ReservedResourceType 'VirtualMachines' -Sku 'Standard_b1ls' -Term 'P1Y' -ReservationOrderId '846655fa-d9e7-4fb8-9512-3ab7367352f1'

ReservationOrderId                   DisplayName Term State     Quantity
------------------                   ----------- ---- -----     --------
846655fa-d9e7-4fb8-9512-3ab7367352f1 TestVm2222  P1Y  Succeeded 1

Proceed reservations purchase with reservation order ID obtained from Get-AzReservationQuote. This is a long running POST operation which can take around 10ish mins.

Parameters

-AppliedScope

List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. This property will be deprecated and replaced by appliedScopeProperties instead for Single AppliedScopeType.

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

-AppliedScopePropertyDisplayName

Display name

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

-AppliedScopePropertyManagementGroupId

Fully-qualified identifier of the management group where the benefit must be applied.

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

-AppliedScopePropertyResourceGroupId

Fully-qualified identifier of the resource group.

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

-AppliedScopePropertySubscriptionId

Fully-qualified identifier of the subscription.

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

-AppliedScopePropertyTenantId

Tenant ID where the savings plan should apply benefit.

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

-AppliedScopeType

Type of the Applied Scope.

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

-AsJob

Run the command as a job

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

-BillingPlan

Represent the billing plans.

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

-BillingScopeId

Subscription that will be charged for purchasing reservation or savings plan

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

-Body

The request for reservation purchase To construct, see NOTES section for BODY properties and create a hash table.

Type:IPurchaseRequest
Position:Named
Default value:None
Required:True
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 DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisplayName

Friendly name of the reservation

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

-InputObject

Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

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

-InstanceFlexibility

Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for VirtualMachines reserved resource type.

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

-Location

The Azure region where the reserved resource lives.

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

-NoWait

Run the command asynchronously

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

-Quantity

Quantity of the skus that are part of the reservation.

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

-Renew

Setting this to true will automatically purchase a new reservation on the expiration date time.

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

-ReservationOrderId

Order Id of the reservation

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

-ReservedResourceType

The type of the resource that is being reserved.

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

-ReviewDateTime

This is the date-time when the Azure hybrid benefit needs to be reviewed.

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

-Sku

.

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

-Term

Represent the term of reservation.

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

Inputs

IPurchaseRequest

IReservationsIdentity

Outputs

IReservationOrderResponse