Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Kusto/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
15 changes: 15 additions & 0 deletions src/Kusto/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bin
obj
.vs
generated
internal
exports
tools
custom/*.psm1
test/*-TestResults.xml
/*.ps1
/*.ps1xml
/*.psm1
/*.snk
/*.csproj
/*.nuspec
24 changes: 24 additions & 0 deletions src/Kusto/Az.Kusto.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@{
GUID = '18c61846-f6f0-425e-ba4b-5cf903e2bdd8'
RootModule = './Az.Kusto.psm1'
ModuleVersion = '0.1.4'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = 'Microsoft Corporation. All rights reserved.'
Description = 'Microsoft Azure PowerShell: Kusto cmdlets'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.Kusto.private.dll'
FormatsToProcess = './Az.Kusto.format.ps1xml'
FunctionsToExport = 'Add-AzKustoClusterLanguageExtension', 'Add-AzKustoDatabasePrincipal', 'Get-AzKustoAttachedDatabaseConfiguration', 'Get-AzKustoCluster', 'Get-AzKustoClusterFollowerDatabase', 'Get-AzKustoClusterLanguageExtension', 'Get-AzKustoClusterPrincipalAssignment', 'Get-AzKustoClusterSku', 'Get-AzKustoDatabase', 'Get-AzKustoDatabasePrincipal', 'Get-AzKustoDatabasePrincipalAssignment', 'Get-AzKustoDataConnection', 'Invoke-AzKustoDataConnectionValidation', 'Invoke-AzKustoDetachClusterFollowerDatabase', 'Invoke-AzKustoDiagnoseClusterVirtualNetwork', 'New-AzKustoAttachedDatabaseConfiguration', 'New-AzKustoCluster', 'New-AzKustoClusterPrincipalAssignment', 'New-AzKustoDatabase', 'New-AzKustoDatabasePrincipalAssignment', 'New-AzKustoDataConnection', 'Remove-AzKustoAttachedDatabaseConfiguration', 'Remove-AzKustoCluster', 'Remove-AzKustoClusterLanguageExtension', 'Remove-AzKustoClusterPrincipalAssignment', 'Remove-AzKustoDatabase', 'Remove-AzKustoDatabasePrincipal', 'Remove-AzKustoDatabasePrincipalAssignment', 'Remove-AzKustoDataConnection', 'Start-AzKustoCluster', 'Stop-AzKustoCluster', 'Test-AzKustoClusterNameAvailability', 'Test-AzKustoClusterPrincipalAssignmentNameAvailability', 'Test-AzKustoDatabaseNameAvailability', 'Test-AzKustoDatabasePrincipalAssignmentNameAvailability', 'Test-AzKustoDataConnectionNameAvailability', 'Update-AzKustoCluster', 'Update-AzKustoDatabase', 'Update-AzKustoDataConnection', '*'
AliasesToExport = '*'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Kusto'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
}
}
}
52 changes: 33 additions & 19 deletions src/Kusto/custom/Invoke-AzKustoDataConnectionValidation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Checks that the data connection parameters are valid.
.Description
Checks that the data connection parameters are valid.
.Example
PS C:\> $dataConnectionProperties = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.EventHubDataConnection -Property @{Location=$location; Kind=$kind; EventHubResourceId=$eventHubResourceId; DataFormat=$dataFormat; ConsumerGroup='$Default'; Compression= "None"; TableName = $tableName; MappingRuleName = $tableMappingName}
PS C:\> $dataConnectionValidation = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.DataConnectionValidation -Property @{DataConnectionName=$dataConnectionName; Property=$dataConnectionProperties}
PS C:\> $dataConnectionProperties = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.EventHubDataConnection -Property @{Location=$location; Kind=$kind; EventHubResourceId=$eventHubResourceId; DataFormat=$dataFormat; ConsumerGroup='$Default'; Compression= "None"; TableName = $tableName; MappingRuleName = $tableMappingName}
PS C:\> $dataConnectionValidation = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.DataConnectionValidation -Property @{DataConnectionName=$dataConnectionName; Property=$dataConnectionProperties}
PS C:\> Invoke-AzKustoDataConnectionValidation -ResourceGroupName $resourceGroupName -ClusterName $clusterName -DatabaseName $databaseName -Parameter $dataConnectionValidation

ErrorMessage
Expand All @@ -31,7 +31,7 @@ event hub resource id and consumer group tuple provided are already used
https://docs.microsoft.com/en-us/powershell/module/az.kusto/invoke-azkustodataconnectionvalidation
#>
function Invoke-AzKustoDataConnectionValidation {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.IDataConnectionValidationResult])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.IDataConnectionValidationResult])]
[CmdletBinding(DefaultParameterSetName = 'DataExpandedEventHub', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
[Parameter(ParameterSetName = 'DataExpandedEventHub', Mandatory)]
Expand Down Expand Up @@ -105,12 +105,21 @@ function Invoke-AzKustoDataConnectionValidation {
# The event/iot hub consumer group.
${ConsumerGroup},

[Parameter(ParameterSetName = 'DataExpandedEventHub')]
[Parameter(ParameterSetName = 'DataExpandedEventGrid', Mandatory)]
[Parameter(ParameterSetName = 'DataExpandedIotHub')]
[Parameter(ParameterSetName = 'DataViaIdentityExpandedEventHub')]
[Parameter(ParameterSetName = 'DataViaIdentityExpandedEventGrid', Mandatory)]
[Parameter(ParameterSetName = 'DataViaIdentityExpandedIotHub')]
[Parameter(ParameterSetName = 'UpdateExpandedEventGrid')]
[Parameter(ParameterSetName = 'UpdateViaIdentityExpandedEventGrid')]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Support.BlobStorageEventType]
# The name of blob storage event type to process.
${BlobStorageEventType},

[Parameter(ParameterSetName = 'UpdateExpandedEventGrid')]
[Parameter(ParameterSetName = 'UpdateViaIdentityExpandedEventGrid')]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Category('Body')]
[System.Management.Automation.SwitchParameter]
# If set to true, indicates that ingestion should ignore the first record of every file.
${IgnoreFirstRecord},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Support.EventGridDataFormat]
# The data format of the message. Optionally the data format can be added to each message.
Expand All @@ -131,12 +140,7 @@ function Invoke-AzKustoDataConnectionValidation {
# The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.
${MappingRuleName},

[Parameter(ParameterSetName = 'DataExpandedEventHub')]
[Parameter(ParameterSetName = 'DataExpandedEventGrid', Mandatory)]
[Parameter(ParameterSetName = 'DataExpandedIotHub')]
[Parameter(ParameterSetName = 'DataViaIdentityExpandedEventHub')]
[Parameter(ParameterSetName = 'DataViaIdentityExpandedEventGrid', Mandatory)]
[Parameter(ParameterSetName = 'DataViaIdentityExpandedIotHub')]
[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Category('Body')]
[System.String]
# The table where the data should be ingested. Optionally the table information can be added to each message.
Expand Down Expand Up @@ -226,13 +230,13 @@ function Invoke-AzKustoDataConnectionValidation {

process {
try {
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.DataConnectionValidation]::new()
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.DataConnectionValidation]::new()

$Parameter.DataConnectionName = $PSBoundParameters['DataConnectionName']
$null = $PSBoundParameters.Remove('DataConnectionName')

if ($PSBoundParameters['Kind'] -eq 'EventHub') {
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.EventHubDataConnection]::new()
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.EventHubDataConnection]::new()

$Parameter.Property.EventHubResourceId = $PSBoundParameters['EventHubResourceId']
$null = $PSBoundParameters.Remove('EventHubResourceId')
Expand All @@ -248,16 +252,26 @@ function Invoke-AzKustoDataConnectionValidation {
}
}
elseif ($PSBoundParameters['Kind'] -eq 'EventGrid') {
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.EventGridDataConnection]::new()
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.EventGridDataConnection]::new()

$Parameter.Property.EventHubResourceId = $PSBoundParameters['EventHubResourceId']
$null = $PSBoundParameters.Remove('EventHubResourceId')

$Parameter.Property.StorageAccountResourceId = $PSBoundParameters['StorageAccountResourceId']
$null = $PSBoundParameters.Remove('StorageAccountResourceId')

if ($PSBoundParameters.ContainsKey('BlobStorageEventType')) {
$Parameter.BlobStorageEventType = $PSBoundParameters['BlobStorageEventType']
$null = $PSBoundParameters.Remove('BlobStorageEventType')
}

if ($PSBoundParameters.ContainsKey('IgnoreFirstRecord')) {
$Parameter.IgnoreFirstRecord = $PSBoundParameters['IgnoreFirstRecord']
$null = $PSBoundParameters.Remove('IgnoreFirstRecord')
}
}
else {
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.IotHubDataConnection]::new()
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.IotHubDataConnection]::new()

$Parameter.Property.IotHubResourceId = $PSBoundParameters['IotHubResourceId']
$null = $PSBoundParameters.Remove('IotHubResourceId')
Expand Down
42 changes: 31 additions & 11 deletions src/Kusto/custom/New-AzKustoDataConnection.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Creates or updates a data connection.
.Description
Creates or updates a data connection.
.Example
PS C:\> $dataConnectionProperties = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.EventHubDataConnection -Property @{Location="East US"; Kind="EventHub"; EventHubResourceId="/subscriptions/$subscriptionId/resourcegroups/testrg/providers/Microsoft.EventHub/namespaces/myeventhubns/eventhubs/myeventhub"; DataFormat="JSON"; ConsumerGroup='$Default'; Compression= "None"; TableName = "Events"; MappingRuleName = "EventsMapping"}
PS C:\> $dataConnectionProperties = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.EventHubDataConnection -Property @{Location="East US"; Kind="EventHub"; EventHubResourceId="/subscriptions/$subscriptionId/resourcegroups/testrg/providers/Microsoft.EventHub/namespaces/myeventhubns/eventhubs/myeventhub"; DataFormat="JSON"; ConsumerGroup='$Default'; Compression= "None"; TableName = "Events"; MappingRuleName = "EventsMapping"}
PS C:\> New-AzKustoDataConnection -ResourceGroupName "testrg" -ClusterName "testnewkustocluster" -DatabaseName "mykustodatabase" -DataConnectionName "mykustodataconnection" -Parameter $dataConnectionProperties

Kind Location Name Type
Expand All @@ -30,7 +30,7 @@ EventHub East US testnewkustocluster/mykustodatabase/mykustodataconnection Micr
https://docs.microsoft.com/en-us/powershell/module/az.kusto/new-azkustodataconnection
#>
function New-AzKustoDataConnection {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.IDataConnection])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.IDataConnection])]
[CmdletBinding(DefaultParameterSetName = 'CreateExpandedEventHub', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
[Parameter(Mandatory)]
Expand Down Expand Up @@ -86,9 +86,21 @@ function New-AzKustoDataConnection {
# The event/iot hub consumer group.
${ConsumerGroup},

[Parameter(ParameterSetName = 'CreateExpandedEventHub')]
[Parameter(ParameterSetName = 'CreateExpandedEventGrid', Mandatory)]
[Parameter(ParameterSetName = 'CreateExpandedIotHub')]
[Parameter(ParameterSetName = 'UpdateExpandedEventGrid')]
[Parameter(ParameterSetName = 'UpdateViaIdentityExpandedEventGrid')]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Support.BlobStorageEventType]
# The name of blob storage event type to process.
${BlobStorageEventType},

[Parameter(ParameterSetName = 'UpdateExpandedEventGrid')]
[Parameter(ParameterSetName = 'UpdateViaIdentityExpandedEventGrid')]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Category('Body')]
[System.Management.Automation.SwitchParameter]
# If set to true, indicates that ingestion should ignore the first record of every file.
${IgnoreFirstRecord},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Support.EventGridDataFormat]
# The data format of the message. Optionally the data format can be added to each message.
Expand All @@ -107,9 +119,7 @@ function New-AzKustoDataConnection {
# The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.
${MappingRuleName},

[Parameter(ParameterSetName = 'CreateExpandedEventHub')]
[Parameter(ParameterSetName = 'CreateExpandedEventGrid', Mandatory)]
[Parameter(ParameterSetName = 'CreateExpandedIotHub')]
[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Kusto.Category('Body')]
[System.String]
# The table where the data should be ingested. Optionally the table information can be added to each message.
Expand Down Expand Up @@ -208,7 +218,7 @@ function New-AzKustoDataConnection {
process {
try {
if ($PSBoundParameters['Kind'] -eq 'EventHub') {
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.EventHubDataConnection]::new()
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.EventHubDataConnection]::new()

$Parameter.EventHubResourceId = $PSBoundParameters['EventHubResourceId']
$null = $PSBoundParameters.Remove('EventHubResourceId')
Expand All @@ -224,16 +234,26 @@ function New-AzKustoDataConnection {
}
}
elseif ($PSBoundParameters['Kind'] -eq 'EventGrid') {
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.EventGridDataConnection]::new()
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.EventGridDataConnection]::new()

$Parameter.EventHubResourceId = $PSBoundParameters['EventHubResourceId']
$null = $PSBoundParameters.Remove('EventHubResourceId')

$Parameter.StorageAccountResourceId = $PSBoundParameters['StorageAccountResourceId']
$null = $PSBoundParameters.Remove('StorageAccountResourceId')

if ($PSBoundParameters.ContainsKey('BlobStorageEventType')) {
$Parameter.BlobStorageEventType = $PSBoundParameters['BlobStorageEventType']
$null = $PSBoundParameters.Remove('BlobStorageEventType')
}

if ($PSBoundParameters.ContainsKey('IgnoreFirstRecord')) {
$Parameter.IgnoreFirstRecord = $PSBoundParameters['IgnoreFirstRecord']
$null = $PSBoundParameters.Remove('IgnoreFirstRecord')
}
}
else {
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.IotHubDataConnection]::new()
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.IotHubDataConnection]::new()

$Parameter.IotHubResourceId = $PSBoundParameters['IotHubResourceId']
$null = $PSBoundParameters.Remove('IotHubResourceId')
Expand Down
4 changes: 2 additions & 2 deletions src/Kusto/custom/New-AzKustoDatabase.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ReadWrite East US testnewkustocluster/mykustodatabase Microsoft.Kusto/Clusters/
https://docs.microsoft.com/en-us/powershell/module/az.kusto/new-azkustodatabase
#>
function New-AzKustoDatabase {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.IDatabase])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.IDatabase])]
[CmdletBinding(PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
[Parameter(Mandatory)]
Expand Down Expand Up @@ -146,7 +146,7 @@ function New-AzKustoDatabase {

process {
try {
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200215.ReadWriteDatabase]::new()
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200614.ReadWriteDatabase]::new()

$Parameter.Kind = $PSBoundParameters['Kind']
$null = $PSBoundParameters.Remove('Kind')
Expand Down
Loading