Dela via


New-AzEventHub

Creates a new Event Hub.

Syntax

EventhubPropertiesSet (Standard)

New-AzEventHub
    [-ResourceGroupName] <String>
    [-Namespace] <String>
    [-Name] <String>
    [-MessageRetentionInDays <Int64>]
    [-PartitionCount <Int64>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

EventhubInputObjectSet

New-AzEventHub
    [-ResourceGroupName] <String>
    [-Namespace] <String>
    [-Name] <String>
    [-InputObject <PSEventHubAttributes>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The New-AzEventHub cmdlet creates a new Azure Event Hub. To create Eventhub with Capture description properties, please follow the below steps (Examples 2).

Exempel

Example 1 - Create new EventHub

PS C:\> New-AzEventHub -ResourceGroupName MyResourceGroupName -NamespaceName MyNamespaceName -Name MyEventHubName

Creates an Event Hub named `MyEventHubName` with a 3-day message retention period and two partitions, in the `WestUS` location, with resource group `MyResourceGroupName`.

Example 2 Update Eventhub with 'CaptureDescription'

PS C:\> New-AzEventHub -ResourceGroupName MyResourceGroupName -NamespaceName MyNamespaceName -Name MyEventHubName -MessageRetentionInDays 3 -PartitionCount 2

PS C:\> $CreatedEventHub = Get-AzEventHub -ResourceGroupName MyResourceGroupName -Namespace MyNamespaceName -Name MyEventHubName

PS C:\> $createdEventHub.CaptureDescription = New-Object -TypeName Microsoft.Azure.Commands.EventHub.Models.PSCaptureDescriptionAttributes

PS C:\> $createdEventHub.CaptureDescription.Enabled = $true
PS C:\> $createdEventHub.CaptureDescription.IntervalInSeconds  = 120
PS C:\> $createdEventHub.CaptureDescription.Encoding  = "Avro"
PS C:\> $createdEventHub.CaptureDescription.SizeLimitInBytes = 10485763
PS C:\> $createdEventHub.CaptureDescription.Destination.Name = "EventHubArchive.AzureBlockBlob"
PS C:\> $createdEventHub.CaptureDescription.Destination.BlobContainer = "container"
PS C:\> $createdEventHub.CaptureDescription.Destination.ArchiveNameFormat = "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"
PS C:\> $createdEventHub.CaptureDescription.Destination.StorageAccountResourceId = "/subscriptions/{SubscriptionId}/resourceGroups/MyResourceGroupName/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage"
PS C:\> Set-AzEventHub -ResourceGroupName MyResourceGroupName -Namespace MyNamespaceName -Name MyEventHubName -InputObject MyCreatedEventHub -messageRetentionInDays 4 -partitionCount 2

Creates an Event Hub named `MyEventHubName` with a 3-day message retention period, 2 partitions and CaptureDescription properties in the `WestUS` location, with resource group `MyResourceGroupName`.

Parametrar

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameteregenskaper

Typ:SwitchParameter
Standardvärde:None
Stöder jokertecken:False
DontShow:False
Alias:cf

Parameteruppsättningar

(All)
Position:Named
Obligatorisk:False
Värde från pipeline:False
Värde från pipeline efter egenskapsnamn:False
Värde från återstående argument:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameteregenskaper

Typ:IAzureContextContainer
Standardvärde:None
Stöder jokertecken:False
DontShow:False
Alias:AzContext, AzureRmContext, AzureCredential

Parameteruppsättningar

(All)
Position:Named
Obligatorisk:False
Värde från pipeline:False
Värde från pipeline efter egenskapsnamn:False
Värde från återstående argument:False

-InputObject

EventHub Input object

Parameteregenskaper

Typ:PSEventHubAttributes
Standardvärde:None
Stöder jokertecken:False
DontShow:False
Alias:EventHubObj

Parameteruppsättningar

EventhubInputObjectSet
Position:Named
Obligatorisk:False
Värde från pipeline:False
Värde från pipeline efter egenskapsnamn:True
Värde från återstående argument:False

-MessageRetentionInDays

Eventhub Message Retention In Days

Parameteregenskaper

Typ:

Nullable<T>[Int64]

Standardvärde:None
Stöder jokertecken:False
DontShow:False

Parameteruppsättningar

EventhubPropertiesSet
Position:Named
Obligatorisk:False
Värde från pipeline:False
Värde från pipeline efter egenskapsnamn:True
Värde från återstående argument:False

-Name

Eventhub Name

Parameteregenskaper

Typ:String
Standardvärde:None
Stöder jokertecken:False
DontShow:False
Alias:EventHubName

Parameteruppsättningar

(All)
Position:3
Obligatorisk:True
Värde från pipeline:False
Värde från pipeline efter egenskapsnamn:True
Värde från återstående argument:False

-Namespace

Namespace Name

Parameteregenskaper

Typ:String
Standardvärde:None
Stöder jokertecken:False
DontShow:False
Alias:NamespaceName

Parameteruppsättningar

(All)
Position:1
Obligatorisk:True
Värde från pipeline:False
Värde från pipeline efter egenskapsnamn:True
Värde från återstående argument:False

-PartitionCount

Eventhub PartitionCount

Parameteregenskaper

Typ:

Nullable<T>[Int64]

Standardvärde:None
Stöder jokertecken:False
DontShow:False

Parameteruppsättningar

EventhubPropertiesSet
Position:Named
Obligatorisk:False
Värde från pipeline:False
Värde från pipeline efter egenskapsnamn:True
Värde från återstående argument:False

-ResourceGroupName

Resource Group Name

Parameteregenskaper

Typ:String
Standardvärde:None
Stöder jokertecken:False
DontShow:False

Parameteruppsättningar

(All)
Position:0
Obligatorisk:True
Värde från pipeline:False
Värde från pipeline efter egenskapsnamn:True
Värde från återstående argument:False

-WhatIf

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

Parameteregenskaper

Typ:SwitchParameter
Standardvärde:None
Stöder jokertecken:False
DontShow:False
Alias:wi

Parameteruppsättningar

(All)
Position:Named
Obligatorisk:False
Värde från pipeline:False
Värde från pipeline efter egenskapsnamn:False
Värde från återstående argument:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Indata

String

PSEventHubAttributes

Nullable<T>

Utdata

PSEventHubAttributes