Dela via


New-AzEventHub

Skapar en ny händelsehubb.

Syntax

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

Description

New-AzEventHub-cmdleten skapar en ny Azure Event Hub. Om du vill skapa Eventhub med egenskaper för avbildningsbeskrivning följer du stegen nedan (exempel 2).

Exempel

Exempel 1 – Skapa ny EventHub

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

Skapar en händelsehubb med namnet "MyEventHubName" med en kvarhållningsperiod på 3 dagar och två partitioner på platsen "WestUS" med resursgruppen "MyResourceGroupName".

Exempel 2 Uppdatera Eventhub med "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

Skapar en händelsehubb med namnet "MyEventHubName" med en kvarhållningsperiod på 3 dagar, 2 partitioner och CaptureDescription-egenskaper på platsen "WestUS" med resursgruppen "MyResourceGroupName".

Parametrar

-Confirm

Uppmanar dig att bekräfta innan du kör cmdleten.

Typ:SwitchParameter
Alias:cf
Position:Named
Standardvärde:None
Obligatorisk:False
Godkänn pipeline-indata:False
Godkänn jokertecken:False

-DefaultProfile

Autentiseringsuppgifter, konto, klientorganisation och prenumeration som används för kommunikation med Azure.

Typ:IAzureContextContainer
Alias:AzContext, AzureRmContext, AzureCredential
Position:Named
Standardvärde:None
Obligatorisk:False
Godkänn pipeline-indata:False
Godkänn jokertecken:False

-InputObject

EventHub-indataobjekt

Typ:PSEventHubAttributes
Alias:EventHubObj
Position:Named
Standardvärde:None
Obligatorisk:False
Godkänn pipeline-indata:True
Godkänn jokertecken:False

-MessageRetentionInDays

Kvarhållning av eventhub-meddelanden i dagar

Typ:Nullable<T>[Int64]
Position:Named
Standardvärde:None
Obligatorisk:False
Godkänn pipeline-indata:True
Godkänn jokertecken:False

-Name

Eventhub-namn

Typ:String
Alias:EventHubName
Position:3
Standardvärde:None
Obligatorisk:True
Godkänn pipeline-indata:True
Godkänn jokertecken:False

-Namespace

Namn på namnområde

Typ:String
Alias:NamespaceName
Position:1
Standardvärde:None
Obligatorisk:True
Godkänn pipeline-indata:True
Godkänn jokertecken:False

-PartitionCount

Eventhub PartitionCount

Typ:Nullable<T>[Int64]
Position:Named
Standardvärde:None
Obligatorisk:False
Godkänn pipeline-indata:True
Godkänn jokertecken:False

-ResourceGroupName

Namnet på resursgruppen

Typ:String
Position:0
Standardvärde:None
Obligatorisk:True
Godkänn pipeline-indata:True
Godkänn jokertecken:False

-WhatIf

Visar vad som skulle hända om cmdleten kördes. Cmdleten körs inte.

Typ:SwitchParameter
Alias:wi
Position:Named
Standardvärde:None
Obligatorisk:False
Godkänn pipeline-indata:False
Godkänn jokertecken:False

Indata

String

PSEventHubAttributes

Nullable<T>[[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

Utdata

PSEventHubAttributes