diff --git a/src/TimeSeriesInsights/custom/New-AzTimeSeriesInsightsEnvironment.ps1 b/src/TimeSeriesInsights/custom/New-AzTimeSeriesInsightsEnvironment.ps1 new file mode 100644 index 000000000000..5885adb8387a --- /dev/null +++ b/src/TimeSeriesInsights/custom/New-AzTimeSeriesInsightsEnvironment.ps1 @@ -0,0 +1,251 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an environment in the specified subscription and resource group. +.Description +Create an environment in the specified subscription and resource group. + +.Link +https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/new-aztimeseriesinsightsenvironment +#> +function New-AzTimeSeriesInsightsEnvironment { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IEnvironmentResource])] + [CmdletBinding(DefaultParameterSetName='standard', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(Mandatory)] + [Alias('EnvironmentName')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Path')] + [System.String] + # Name of the environment + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Path')] + [System.String] + # Name of an Azure Resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [ArgumentCompleter({param ( $CommandName, $ParameterName, $WordToComplete, $CommandAst, $FakeBoundParameters ) return @('Standard', 'LongTerm')})] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.Kind] + # The kind of the environment. + ${Kind}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.String] + # The location of the resource. + ${Location}, + + [Parameter(ParameterSetName='standard', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.Int32] + # The capacity of the sku. + # For standard environments, this value can be changed to support scale out of environments after they have been created. + ${Capacity}, + + [Parameter(ParameterSetName='standard', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.TimeSpan] + # The data retention time. + ${DataRetentionTime}, + + [Parameter(ParameterSetName='standard')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ITimeSeriesIdProperty[]] + # The list of event properties which will be used to partition data in the environment. + ${PartitionKeyProperty}, + + [Parameter(ParameterSetName='standard')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.String] + # The behavior the Time Series Insights service should take when the environment's capacity has been exceeded + ${StorageLimitExceededBehavior}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.SkuName])] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.SkuName] + # The name of this SKU. + ${Sku}, + + [Parameter(ParameterSetName='longterm', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ITimeSeriesIdProperty[]] + # The list of event properties which will be used to define the environment's time series id. + ${TimeSeriesIdProperty}, + + [Parameter(ParameterSetName='longterm', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.String] + # The name of the storage account that will hold the environment's long term data. + ${StorageAccountName}, + + [Parameter(ParameterSetName='longterm', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.Security.SecureString] + # The value of the management key that grants the Time Series Insights service write access to the storage account. + ${StorageAccountKey}, + + [Parameter(ParameterSetName='longterm')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.TimeSpan] + # ISO8601 timespan specifying the number of days the environment's events will be available for query from the warm store. + ${WarmStoreDataRetentionTime}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ICreateOrUpdateTrackedResourcePropertiesTags]))] + [System.Collections.Hashtable] + # Key-value pairs of additional properties for the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + + + process { + try { + if ($PSBoundParameters['Kind'] -eq 'Standard') { + $Parameter = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.StandardEnvironmentCreateOrUpdateParameters]::new() + $Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.StandardEnvironmentCreationProperties]::new() + + $Parameter.SkuCapacity = $PSBoundParameters['Capacity'] + $null = $PSBoundParameters.Remove('Capacity') + + $Parameter.Property.DataRetentionTime = $PSBoundParameters['DataRetentionTime'] + $null = $PSBoundParameters.Remove('DataRetentionTime') + + if ($PSBoundParameters.ContainsKey('PartitionKeyProperty')) { + $Parameter.Property.PartitionKeyProperty = $PSBoundParameters['PartitionKeyProperty'] + $null = $PSBoundParameters.Remove('PartitionKeyProperty') + } + + if ($PSBoundParameters.ContainsKey('StorageLimitExceededBehavior')) { + $Parameter.Property.StorageLimitExceededBehavior = $PSBoundParameters['StorageLimitExceededBehavior'] + $null = $PSBoundParameters.Remove('StorageLimitExceededBehavior') + } + } else { + $Parameter = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.LongTermEnvironmentCreateOrUpdateParameters]::new() + $Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.LongTermEnvironmentCreationProperties]::new() + + $Parameter.Property.StorageConfigurationAccountName = $PSBoundParameters['StorageAccountName'] + $null = $PSBoundParameters.Remove('StorageAccountName') + + $Parameter.Property.StorageConfigurationManagementKey = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['StorageAccountKey'])) + $null = $PSBoundParameters.Remove('StorageAccountKey') + + $Parameter.Property.TimeSeriesIdProperty = $PSBoundParameters['TimeSeriesIdProperty'] + $null = $PSBoundParameters.Remove('TimeSeriesIdProperty') + + # For L1, SkuCapacity is 1, which is a service side behavior + $Parameter.SkuCapacity = 1 + + if ($PSBoundParameters.ContainsKey('WarmStoreDataRetentionTime')) { + $Parameter.Property.WarmStoreConfigurationDataRetention = $PSBoundParameters['WarmStoreDataRetentionTime'] + $null = $PSBoundParameters.Remove('WarmStoreDataRetentionTime') + } + } + $Parameter.Kind = $PSBoundParameters['Kind'] + $null = $PSBoundParameters.Remove('Kind') + + $Parameter.Location = $PSBoundParameters['Location'] + $null = $PSBoundParameters.Remove('Location') + + $Parameter.SkuName = $PSBoundParameters['Sku'] + $null = $PSBoundParameters.Remove('Sku') + + if ($PSBoundParameters.ContainsKey('Tag')) { + $Parameter.Tag = $PSBoundParameters['Tag'] + $null = $PSBoundParameters.Remove('Tag') + } + + $null = $PSBoundParameters.Add('Parameter', $Parameter) + + Az.TimeSeriesInsights.internal\New-AzTimeSeriesInsightsEnvironment @PSBoundParameters + } catch { + throw + } + } +} + \ No newline at end of file diff --git a/src/TimeSeriesInsights/custom/New-AzTimeSeriesInsightsEventSource.ps1 b/src/TimeSeriesInsights/custom/New-AzTimeSeriesInsightsEventSource.ps1 new file mode 100644 index 000000000000..df4d6a14f535 --- /dev/null +++ b/src/TimeSeriesInsights/custom/New-AzTimeSeriesInsightsEventSource.ps1 @@ -0,0 +1,228 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an event source under the specified environment. +.Description +Create an event source under the specified environment. + +.Link +https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/new-aztimeseriesinsightseventsource +#> +function New-AzTimeSeriesInsightsEventSource { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IEventSourceResource])] + [CmdletBinding(DefaultParameterSetName='eventhub', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Path')] + [System.String] + # The name of the Time Series Insights environment associated with the specified resource group. + ${EnvironmentName}, + + [Parameter(Mandatory)] + [Alias('EventSourceName')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Path')] + [System.String] + # Name of the event source. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Path')] + [System.String] + # Name of an Azure Resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [ArgumentCompleter({param ( $CommandName, $ParameterName, $WordToComplete, $CommandAst, $FakeBoundParameters ) return @('Microsoft.EventHub', 'Microsoft.IoTHub')})] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.Kind] + # The kind of the event source. + ${Kind}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.String] + # The location of the resource. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ICreateOrUpdateTrackedResourcePropertiesTags]))] + [System.Collections.Hashtable] + # Key-value pairs of additional properties for the resource. + ${Tag}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.String] + # The name of the event/iot hub's consumer group that holds the partitions from which events will be read. + ${ConsumerGroupName}, + + [Parameter(ParameterSetName='eventhub', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.String] + # The name of the event hub. + ${EventHubName}, + + [Parameter(ParameterSetName='iothub', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.String] + # The name of the iot hub. + ${IoTHubName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.String] + # The name of the SAS key that grants the Time Series Insights service access to the event/iot hub. + ${KeyName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.String] + # The resource id of the event source in Azure Resource Manager. + ${EventSourceResourceId}, + + [Parameter(ParameterSetName='eventhub', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.String] + # The name of the service bus that contains the event hub. + ${ServiceBusNameSpace}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.Security.SecureString] + # The value of the shared access key that grants the Time Series Insights service read access to the event/iot hub. + ${SharedAccessKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Body')] + [System.String] + # The event property that will be used as the event source's timestamp. + ${TimeStampPropertyName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + + process { + try { + if ($PSBoundParameters['Kind'] -eq 'Microsoft.EventHub') { + $Parameter = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.EventHubEventSourceCreateOrUpdateParameters]::new() + $Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.EventHubEventSourceCreationProperties]::new() + + $Parameter.Property.EventHubName = $PSBoundParameters['EventHubName'] + $null = $PSBoundParameters.Remove('EventHubName') + + $Parameter.Property.ServiceBusNameSpace = $PSBoundParameters['ServiceBusNameSpace'] + $null = $PSBoundParameters.Remove('ServiceBusNameSpace') + } else { + $Parameter = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IoTHubEventSourceCreateOrUpdateParameters]::new() + $Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IoTHubEventSourceCreationProperties]::new() + + $Parameter.Property.IoTHubName = $PSBoundParameters['IoTHubName'] + $null = $PSBoundParameters.Remove('IoTHubName') + } + $Parameter.Kind = $PSBoundParameters['Kind'] + $null = $PSBoundParameters.Remove('Kind') + + $Parameter.Location = $PSBoundParameters['Location'] + $null = $PSBoundParameters.Remove('Location') + + $Parameter.Property.EventSourceResourceId = $PSBoundParameters['EventSourceResourceId'] + $null = $PSBoundParameters.Remove('EventSourceResourceId') + + $Parameter.Property.ConsumerGroupName = $PSBoundParameters['ConsumerGroupName'] + $null = $PSBoundParameters.Remove('ConsumerGroupName') + + $Parameter.Property.KeyName = $PSBoundParameters['KeyName'] + $null = $PSBoundParameters.Remove('KeyName') + + $Parameter.Property.SharedAccessKey = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['SharedAccessKey'])) + $null = $PSBoundParameters.Remove('SharedAccessKey') + + if ($PSBoundParameters.ContainsKey('Tag')) { + $Parameter.Tag = $PSBoundParameters['Tag'] + $null = $PSBoundParameters.Remove('Tag') + } + + if ($PSBoundParameters.ContainsKey('TimeStampPropertyName')) { + $Parameter.Property.TimeStampPropertyName = $PSBoundParameters['TimeStampPropertyName'] + $null = $PSBoundParameters.Remove('TimeStampPropertyName') + } + + $null = $PSBoundParameters.Add('Parameter', $Parameter) + + Az.TimeSeriesInsights.internal\New-AzTimeSeriesInsightsEventSource @PSBoundParameters + } catch { + throw + } + } + + +} + \ No newline at end of file diff --git a/src/TimeSeriesInsights/custom/readme.md b/src/TimeSeriesInsights/custom/readme.md new file mode 100644 index 000000000000..72188c363c6a --- /dev/null +++ b/src/TimeSeriesInsights/custom/readme.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.TimeSeriesInsights` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.TimeSeriesInsights.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.TimeSeriesInsights` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.TimeSeriesInsights.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.TimeSeriesInsights.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundemental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. + +## Purpose +This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. + +## Usage +The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.TimeSeriesInsights`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.DescriptionAttribute` + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. +- `Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.TimeSeriesInsights`. +- `Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.TimeSeriesInsights`. For more information, see [readme.md](..\internal/readme.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/TimeSeriesInsights/docs/Az.TimeSeriesInsights.md b/src/TimeSeriesInsights/docs/Az.TimeSeriesInsights.md new file mode 100644 index 000000000000..34438cff1e97 --- /dev/null +++ b/src/TimeSeriesInsights/docs/Az.TimeSeriesInsights.md @@ -0,0 +1,61 @@ +--- +Module Name: Az.TimeSeriesInsights +Module Guid: 02d7130c-f4fa-4432-b57e-c66af9708f66 +Download Help Link: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.TimeSeriesInsights Module +## Description +Microsoft Azure PowerShell: TimeSeriesInsights cmdlets + +## Az.TimeSeriesInsights Cmdlets +### [Get-AzTimeSeriesInsightsAccessPolicy](Get-AzTimeSeriesInsightsAccessPolicy.md) +Gets the access policy with the specified name in the specified environment. + +### [Get-AzTimeSeriesInsightsEnvironment](Get-AzTimeSeriesInsightsEnvironment.md) +Gets the environment with the specified name in the specified subscription and resource group. + +### [Get-AzTimeSeriesInsightsEventSource](Get-AzTimeSeriesInsightsEventSource.md) +Gets the event source with the specified name in the specified environment. + +### [Get-AzTimeSeriesInsightsReferenceDataSet](Get-AzTimeSeriesInsightsReferenceDataSet.md) +Gets the reference data set with the specified name in the specified environment. + +### [New-AzTimeSeriesInsightsAccessPolicy](New-AzTimeSeriesInsightsAccessPolicy.md) +Create or update an access policy in the specified environment. + +### [New-AzTimeSeriesInsightsEnvironment](New-AzTimeSeriesInsightsEnvironment.md) +Create an environment in the specified subscription and resource group. + +### [New-AzTimeSeriesInsightsEventSource](New-AzTimeSeriesInsightsEventSource.md) +Create an event source under the specified environment. + +### [New-AzTimeSeriesInsightsReferenceDataSet](New-AzTimeSeriesInsightsReferenceDataSet.md) +Create or update a reference data set in the specified environment. + +### [Remove-AzTimeSeriesInsightsAccessPolicy](Remove-AzTimeSeriesInsightsAccessPolicy.md) +Deletes the access policy with the specified name in the specified subscription, resource group, and environment + +### [Remove-AzTimeSeriesInsightsEnvironment](Remove-AzTimeSeriesInsightsEnvironment.md) +Deletes the environment with the specified name in the specified subscription and resource group. + +### [Remove-AzTimeSeriesInsightsEventSource](Remove-AzTimeSeriesInsightsEventSource.md) +Deletes the event source with the specified name in the specified subscription, resource group, and environment + +### [Remove-AzTimeSeriesInsightsReferenceDataSet](Remove-AzTimeSeriesInsightsReferenceDataSet.md) +Deletes the reference data set with the specified name in the specified subscription, resource group, and environment + +### [Update-AzTimeSeriesInsightsAccessPolicy](Update-AzTimeSeriesInsightsAccessPolicy.md) +Updates the access policy with the specified name in the specified subscription, resource group, and environment. + +### [Update-AzTimeSeriesInsightsEnvironment](Update-AzTimeSeriesInsightsEnvironment.md) +Updates the environment with the specified name in the specified subscription and resource group. + +### [Update-AzTimeSeriesInsightsEventSource](Update-AzTimeSeriesInsightsEventSource.md) +Updates the event source with the specified name in the specified subscription, resource group, and environment. + +### [Update-AzTimeSeriesInsightsReferenceDataSet](Update-AzTimeSeriesInsightsReferenceDataSet.md) +Updates the reference data set with the specified name in the specified subscription, resource group, and environment. + diff --git a/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsAccessPolicy.md b/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsAccessPolicy.md new file mode 100644 index 000000000000..1fca48eeea87 --- /dev/null +++ b/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsAccessPolicy.md @@ -0,0 +1,200 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/get-aztimeseriesinsightsaccesspolicy +schema: 2.0.0 +--- + +# Get-AzTimeSeriesInsightsAccessPolicy + +## SYNOPSIS +Gets the access policy with the specified name in the specified environment. + +## SYNTAX + +### List (Default) +``` +Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName -Name -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzTimeSeriesInsightsAccessPolicy -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the access policy with the specified name in the specified environment. + +## EXAMPLES + +### Example 1: List all access policies under a specified environment +```powershell +PS C:\> Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -ResourceGroupName testgroup + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +policy002 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command lists all access policies under a specified environment. + +### Example 2: Get a specified access policy by name +```powershell +PS C:\> Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -ResourceGroupName testgroup -Name policy001 + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command gets a specified access policy. + +### Example 3: Get a specified access policy by object +```powershell +PS C:\>$ap = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsi-envv8u56x -ResourceGroupName tsi-test-i01k5l -Name tsi-apilgj5y +PS C:\>Get-AzTimeSeriesInsightsAccessPolicy -InputObject $ap + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command gets a specified access policy. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights access policy associated with the specified environment. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: AccessPolicyName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IAccessPolicyResource + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsEnvironment.md b/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsEnvironment.md new file mode 100644 index 000000000000..7c9a28c1dcf5 --- /dev/null +++ b/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsEnvironment.md @@ -0,0 +1,280 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/get-aztimeseriesinsightsenvironment +schema: 2.0.0 +--- + +# Get-AzTimeSeriesInsightsEnvironment + +## SYNOPSIS +Gets the environment with the specified name in the specified subscription and resource group. + +## SYNTAX + +### List1 (Default) +``` +Get-AzTimeSeriesInsightsEnvironment [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### Get +``` +Get-AzTimeSeriesInsightsEnvironment -Name -ResourceGroupName [-SubscriptionId ] + [-Expand ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzTimeSeriesInsightsEnvironment -InputObject [-Expand ] + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the environment with the specified name in the specified subscription and resource group. + +## EXAMPLES + +### Example 1: Get a time series insights environment +```powershell +PS C:\> Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsitest001 + +DataAccessFqdn : b6d113a4-0865-405f-b09e-ad4355b5d046.env.timeseries.azure.com +DataAccessId : b6d113a4-0865-405f-b09e-ad4355b5d046 +DataRetentionTime : 1.01:25:00 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest + 001 +IngressState : +Kind : Standard +Location : eastus +Name : tsitest001 +PartitionKeyProperty : +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 2 +SkuName : S1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageLimitExceededBehavior : PurgeOldData +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +Type : Microsoft.TimeSeriesInsights/Environments +``` + +This command gets a time series insights environment. + +### Example 2: List all time series insights environments +```powershell +PS C:\> Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup + +DataAccessFqdn : 3de1d1e1-4f9b-4bc6-aad3-a835597dcd86.env.timeseries.azure.com +DataAccessId : 3de1d1e1-4f9b-4bc6-aad3-a835597dcd86 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/ + tsill +IngressState : +Kind : LongTerm +Location : EastUs +Name : tsill +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 1 +SkuName : L1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageConfigurationAccountName : cdolauli +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimeSeriesIdProperty : {ccc} +Type : Microsoft.TimeSeriesInsights/Environments +WarmStoreConfigurationDataRetention : 00:00:00 + +DataAccessFqdn : b6d113a4-0865-405f-b09e-ad4355b5d046.env.timeseries.azure.com +DataAccessId : b6d113a4-0865-405f-b09e-ad4355b5d046 +DataRetentionTime : 1.01:25:00 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest + 001 +IngressState : +Kind : Standard +Location : eastus +Name : tsitest001 +PartitionKeyProperty : +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 2 +SkuName : S1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageLimitExceededBehavior : PurgeOldData +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +Type : Microsoft.TimeSeriesInsights/Environments +``` + +This command lists all time series insights environments in a resource group. + +### Example 3: Get a time series insights environment by object +```powershell +PS C:\> $env = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName tsi-test-i01k5l -EnvironmentName tsi-envv8u56x +PS C:\> Get-AzTimeSeriesInsightsEnvironment -InputObject $env + +DataAccessFqdn : d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com +DataAccessId : d76a61f2-8a30-41a5-9587-f241eb9b48d9 +DataRetentionTime : 1.01:25:00 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x +IngressState : +Kind : Standard +Location : eastus2 +Name : tsi-envv8u56x +PartitionKeyProperty : +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 1 +SkuName : S1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageLimitExceededBehavior : PurgeOldData +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +Type : Microsoft.TimeSeriesInsights/Environments +``` + +This command gets a time series insights environments. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Expand +Setting $expand=status will include the status of the internal services of the environment in the Time Series Insights service. + +```yaml +Type: System.String +Parameter Sets: Get, GetViaIdentity +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: EnvironmentName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IEnvironmentResource + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsEventSource.md b/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsEventSource.md new file mode 100644 index 000000000000..29c20eaf5a5d --- /dev/null +++ b/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsEventSource.md @@ -0,0 +1,241 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/get-aztimeseriesinsightseventsource +schema: 2.0.0 +--- + +# Get-AzTimeSeriesInsightsEventSource + +## SYNOPSIS +Gets the event source with the specified name in the specified environment. + +## SYNTAX + +### List (Default) +``` +Get-AzTimeSeriesInsightsEventSource -EnvironmentName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzTimeSeriesInsightsEventSource -EnvironmentName -Name -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzTimeSeriesInsightsEventSource -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the event source with the specified name in the specified environment. + +## EXAMPLES + +### Example 1: List all event sources under the specified environment +```powershell +PS C:\> Get-AzTimeSeriesInsightsEventSource -ResourceGroupName testgroup -EnvironmentName tsitest001 + +ConsumerGroupName : testgroup2 +EventHubName : hubname001 +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup2/providers/Microsoft.EventHub/namespaces/spacename001/eventhubs/hu + bname001 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest001/eve + ntsources/estest001 +KeyName : RootManageSharedAccessKey +Kind : Microsoft.EventHub +Location : eastus +Name : estest001 +ServiceBusNamespace : spacename001 +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources + +ConsumerGroupName : testgroup2 +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup2/providers/Microsoft.Devices/IotHubs/iotname001 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest001/eve + ntsources/iots001 +IotHubName : iotname001 +KeyName : RootManageSharedAccessKey +Kind : Microsoft.IoTHub +Location : eastus +Name : iots001 +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command lists all event sources under the specified environments. + +### Example 2: Get a specified event source by name +```powershell +PS C:\> Get-AzTimeSeriesInsightsEventSource -ResourceGroupName testgroup -EnvironmentName tsitest001 -Name iots001 + +ConsumerGroupName : testgroup2 +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup2/providers/Microsoft.Devices/IotHubs/iotname001 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest001/eve + ntsources/iots001 +IotHubName : iotname001 +KeyName : RootManageSharedAccessKey +Kind : Microsoft.IoTHub +Location : eastus +Name : iots001 +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command gets a specific event source. + +### Example 3: Get a specified event source by object +```powershell +PS C:\> $es = Get-AzTimeSeriesInsightsEventSource -ResourceGroupName tsi-test-i01k5l -EnvironmentName tsi-envv8u56x -Name tsi-esrfyi9h +PS C:\> Get-AzTimeSeriesInsightsEventSource -InputObject $es + +ConsumerGroupName : tsi-test-i01k5l +EventHubName : eventhubname-d2rvmp +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-0t3khp/eventhubs/eventhubname-d2rvmp +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h +KeyName : RootManageSharedAccessKey +Kind : Microsoft.EventHub +Location : eastus2 +Name : tsi-esrfyi9h +ServiceBusNamespace : eventhubspace-0t3khp +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command gets a specific event source. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights event source associated with the specified environment. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: EventSourceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IEventSourceResource + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsReferenceDataSet.md b/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsReferenceDataSet.md new file mode 100644 index 000000000000..69801f9b127c --- /dev/null +++ b/src/TimeSeriesInsights/docs/Get-AzTimeSeriesInsightsReferenceDataSet.md @@ -0,0 +1,200 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/get-aztimeseriesinsightsreferencedataset +schema: 2.0.0 +--- + +# Get-AzTimeSeriesInsightsReferenceDataSet + +## SYNOPSIS +Gets the reference data set with the specified name in the specified environment. + +## SYNTAX + +### List (Default) +``` +Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName -Name -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzTimeSeriesInsightsReferenceDataSet -InputObject + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the reference data set with the specified name in the specified environment. + +## EXAMPLES + +### Example 1: List all reference data sets under the specified environment +```powershell +PS C:\> Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dstest001 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +eastus dstest002 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command lists all reference data sets under the specified environment. + +### Example 2: Get a specified reference data set by name +```powershell +PS C:\> Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -ResourceGroupName testgroup -ReferenceDataSetName dstest001 + +Location Name Type +-------- ---- ---- +eastus dstest001 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command gets a specified reference data set. + +### Example 3: Get a specified reference data set by object +```powershell +PS C:\> $ds = Get-AzTimeSeriesInsightsReferenceDataSet -ResourceGroupName tsi-test-i01k5l -EnvironmentName tsi-envv8u56x -Name tsirdsqwufij +PS C:\>Get-AzTimeSeriesInsightsReferenceDataSet -InputObject $ds + +Location Name Type +-------- ---- ---- +eastus2 tsirdsqwufij Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command gets a specified reference data set. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights reference data set associated with the specified environment. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: ReferenceDataSetName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IReferenceDataSetResource + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsAccessPolicy.md b/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsAccessPolicy.md new file mode 100644 index 000000000000..430182482b7c --- /dev/null +++ b/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsAccessPolicy.md @@ -0,0 +1,214 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/new-aztimeseriesinsightsaccesspolicy +schema: 2.0.0 +--- + +# New-AzTimeSeriesInsightsAccessPolicy + +## SYNOPSIS +Create or update an access policy in the specified environment. + +## SYNTAX + +``` +New-AzTimeSeriesInsightsAccessPolicy -EnvironmentName -Name -ResourceGroupName + [-SubscriptionId ] [-Description ] [-PrincipalObjectId ] [-Role ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create or update an access policy in the specified environment. + +## EXAMPLES + +### Example 1: Create an access policy for a specified environment +```powershell +PS C:\> New-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -ResourceGroupName testgroup -PrincipalObjectId ce74a389-b5e8-4f16-89c7-787031ddd903 -Role Contributor -Name policy001 + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command creates an access policy for a specified environment. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Description +An description of the access policy. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +Name of the access policy. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: AccessPolicyName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -PrincipalObjectId +The objectId of the principal in Azure Active Directory. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Role +The list of roles the principal is assigned on the environment. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.AccessPolicyRole[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IAccessPolicyResource + +## ALIASES + +## NOTES + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsEnvironment.md b/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsEnvironment.md new file mode 100644 index 000000000000..b40d12d786f4 --- /dev/null +++ b/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsEnvironment.md @@ -0,0 +1,414 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/new-aztimeseriesinsightsenvironment +schema: 2.0.0 +--- + +# New-AzTimeSeriesInsightsEnvironment + +## SYNOPSIS +Create an environment in the specified subscription and resource group. + +## SYNTAX + +### standard (Default) +``` +New-AzTimeSeriesInsightsEnvironment -Name -ResourceGroupName -Capacity + -DataRetentionTime -Kind -Location -Sku [-SubscriptionId ] + [-PartitionKeyProperty ] [-StorageLimitExceededBehavior ] [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### longterm +``` +New-AzTimeSeriesInsightsEnvironment -Name -ResourceGroupName -Kind -Location + -Sku -StorageAccountKey -StorageAccountName + -TimeSeriesIdProperty [-SubscriptionId ] [-Tag ] + [-WarmStoreDataRetentionTime ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Create an environment in the specified subscription and resource group. + +## EXAMPLES + +### Example 1: Create a standard time series insights environment +```powershell +PS C:\> $TimeSpan = New-TimeSpan -Days 1 -Hours 1 -Minutes 25 +PS C:\> New-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsitest001 -Kind Standard -Location eastus -Sku S1 -DataRetentionTime $TimeSpan -Capacity 2 + +Kind Location Name SkuCapacity SkuName Type +---- -------- ---- ----------- ------- ---- +Standard eastus tsitest001 2 S1 Microsoft.TimeSeriesInsights/Environments +``` + +This command creates a standard time series insights environment. + +### Example 2: Create a longterm time series insights environment +```powershell +PS C:\> New-AzStorageAccount -ResourceGroupName testgroup -AccountName staccount001 -Location eastus -SkuName Standard_GRS +PS C:\> $ks = Get-AzStorageAccountKey -ResourceGroupName "testgroup" -Name "staccount001" +PS C:\> $k = $ks[0] | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsitest002 -Kind LongTerm -Location eastus -Sku L1 -StorageAccountName staccount001 -StorageAccountKey $k -TimeSeriesIdProperty @{name='cdc';type='string'} + +Kind Location Name SkuCapacity SkuName Type +---- -------- ---- ----------- ------- ---- +LongTerm eastus tsitest002 1 L1 Microsoft.TimeSeriesInsights/Environments +``` + +This command creates a longterm time series insights environment. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Capacity +The capacity of the sku. +For standard environments, this value can be changed to support scale out of environments after they have been created. + +```yaml +Type: System.Int32 +Parameter Sets: standard +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -DataRetentionTime +The data retention time. + +```yaml +Type: System.TimeSpan +Parameter Sets: standard +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Kind +The kind of the environment. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.Kind +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Location +The location of the resource. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +Name of the environment + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: EnvironmentName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -PartitionKeyProperty +The list of event properties which will be used to partition data in the environment. +To construct, see NOTES section for PARTITIONKEYPROPERTY properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ITimeSeriesIdProperty[] +Parameter Sets: standard +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Sku +The name of this SKU. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.SkuName +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -StorageAccountKey +The value of the management key that grants the Time Series Insights service write access to the storage account. + +```yaml +Type: System.Security.SecureString +Parameter Sets: longterm +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -StorageAccountName +The name of the storage account that will hold the environment's long term data. + +```yaml +Type: System.String +Parameter Sets: longterm +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -StorageLimitExceededBehavior +The behavior the Time Series Insights service should take when the environment's capacity has been exceeded + +```yaml +Type: System.String +Parameter Sets: standard +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Tag +Key-value pairs of additional properties for the resource. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -TimeSeriesIdProperty +The list of event properties which will be used to define the environment's time series id. +To construct, see NOTES section for TIMESERIESIDPROPERTY properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ITimeSeriesIdProperty[] +Parameter Sets: longterm +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WarmStoreDataRetentionTime +ISO8601 timespan specifying the number of days the environment's events will be available for query from the warm store. + +```yaml +Type: System.TimeSpan +Parameter Sets: longterm +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IEnvironmentResource + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### PARTITIONKEYPROPERTY : The list of event properties which will be used to partition data in the environment. + - `[Name ]`: The name of the property. + - `[Type ]`: The type of the property. + +#### TIMESERIESIDPROPERTY : The list of event properties which will be used to define the environment's time series id. + - `[Name ]`: The name of the property. + - `[Type ]`: The type of the property. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsEventSource.md b/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsEventSource.md new file mode 100644 index 000000000000..c4507fd76bb8 --- /dev/null +++ b/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsEventSource.md @@ -0,0 +1,371 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/new-aztimeseriesinsightseventsource +schema: 2.0.0 +--- + +# New-AzTimeSeriesInsightsEventSource + +## SYNOPSIS +Create an event source under the specified environment. + +## SYNTAX + +### eventhub (Default) +``` +New-AzTimeSeriesInsightsEventSource -EnvironmentName -Name -ResourceGroupName + -ConsumerGroupName -EventHubName -EventSourceResourceId -KeyName + -Kind -Location -ServiceBusNameSpace -SharedAccessKey + [-SubscriptionId ] [-Tag ] [-TimeStampPropertyName ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### iothub +``` +New-AzTimeSeriesInsightsEventSource -EnvironmentName -Name -ResourceGroupName + -ConsumerGroupName -EventSourceResourceId -IoTHubName -KeyName + -Kind -Location -SharedAccessKey [-SubscriptionId ] [-Tag ] + [-TimeStampPropertyName ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create an event source under the specified environment. + +## EXAMPLES + +### Example 1: Create an eventhub event source under the specified environment +```powershell +PS C:\> $ev = New-AzEventHub -ResourceGroupName testgroup2 -NamespaceName spacename001 -Name hubname001 -MessageRetentionInDays 3 -PartitionCount 2 +PS C:\> $ks = Get-AzEventHubKey -ResourceGroupName testgroup2 -NamespaceName spacename001 -AuthorizationRuleName RootManageSharedAccessKey +PS C:\> $k = $ks.PrimaryKey | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzTimeSeriesInsightsEventSource -ResourceGroupName testgroup -Name estest001 -EnvironmentName tsitest001 -Kind Microsoft.EventHub -ConsumerGroupName testgroup2 -Location eastus -KeyName RootManageSharedAccessKey -ServiceBusNameSpace spacename001 -EventHubName hubname001 -EventSourceResourceId $ev.id -SharedAccessKey $k + +Kind Location Name Type +---- -------- ---- ---- +Microsoft.EventHub eastus estest001 Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command creates an eventhub event source under the specified environment. + +### Example 2: Create an iothub event source under the specified environment +```powershell +PS C:\> $ev = New-AzIotHub -ResourceGroupName testgroup2 -Location eastus -Name iotname001 -SkuName S1 -Units 100 +PS C:\> $ks = Get-AzIotHubKey -ResourceGroupName testgroup2 -Name iotname001 +PS C:\> $k = $ks[0].PrimaryKey | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzTimeSeriesInsightsEventSource -ResourceGroupName testgroup -Name iots001 +-EnvironmentName tsitest001 -Kind Microsoft.IoTHub -ConsumerGroupName testgroup2 -Location eastus -KeyName RootManageSharedAccessKey -IoTHubName iotname001 -EventSourceResourceId $ev.id -SharedAccessKey $k + +Location Name Type Kind +-------- ---- ---- ---- +eastus iots001 Microsoft.TimeSeriesInsights/Environments/EventSources Microsoft.IoTHub +``` + +This command creates an iothub event source under the specified environment. + +## PARAMETERS + +### -ConsumerGroupName +The name of the event/iot hub's consumer group that holds the partitions from which events will be read. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EventHubName +The name of the event hub. + +```yaml +Type: System.String +Parameter Sets: eventhub +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EventSourceResourceId +The resource id of the event source in Azure Resource Manager. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -IoTHubName +The name of the iot hub. + +```yaml +Type: System.String +Parameter Sets: iothub +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -KeyName +The name of the SAS key that grants the Time Series Insights service access to the event/iot hub. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Kind +The kind of the event source. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.Kind +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Location +The location of the resource. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +Name of the event source. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: EventSourceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ServiceBusNameSpace +The name of the service bus that contains the event hub. + +```yaml +Type: System.String +Parameter Sets: eventhub +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SharedAccessKey +The value of the shared access key that grants the Time Series Insights service read access to the event/iot hub. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Tag +Key-value pairs of additional properties for the resource. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -TimeStampPropertyName +The event property that will be used as the event source's timestamp. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IEventSourceResource + +## ALIASES + +## NOTES + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsReferenceDataSet.md b/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsReferenceDataSet.md new file mode 100644 index 000000000000..dbdcd7485872 --- /dev/null +++ b/src/TimeSeriesInsights/docs/New-AzTimeSeriesInsightsReferenceDataSet.md @@ -0,0 +1,242 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/new-aztimeseriesinsightsreferencedataset +schema: 2.0.0 +--- + +# New-AzTimeSeriesInsightsReferenceDataSet + +## SYNOPSIS +Create or update a reference data set in the specified environment. + +## SYNTAX + +``` +New-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName -Name -ResourceGroupName + -KeyProperty -Location [-SubscriptionId ] + [-DataStringComparisonBehavior ] [-Tag ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create or update a reference data set in the specified environment. + +## EXAMPLES + +### Example 1: Create a reference data set for a specified environment +```powershell +PS C:\> $mykeyproperties = @{ "name" = "device01"; "type" = "Double"} +PS C:\> New-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -Name dstest001 -ResourceGroupName testgroup -Location eastus -DataStringComparisonBehavior Ordinal -KeyProperty $mykeyproperties + +Location Name Type +-------- ---- ---- +eastus dstest001 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command creates a reference data set for a specific environment. + +## PARAMETERS + +### -DataStringComparisonBehavior +The reference data set key comparison behavior can be set using this property. +By default, the value is 'Ordinal' - which means case sensitive key comparison will be performed while joining reference data with events or while adding new reference data. +When 'OrdinalIgnoreCase' is set, case insensitive comparison will be used. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.DataStringComparisonBehavior +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -KeyProperty +The list of key properties for the reference data set. +To construct, see NOTES section for KEYPROPERTY properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IReferenceDataSetKeyProperty[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Location +The location of the resource. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +Name of the reference data set. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: ReferenceDataSetName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Tag +Key-value pairs of additional properties for the resource. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IReferenceDataSetResource + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### KEYPROPERTY : The list of key properties for the reference data set. + - `[Name ]`: The name of the key property. + - `[Type ]`: The type of the key property. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsAccessPolicy.md b/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsAccessPolicy.md new file mode 100644 index 000000000000..4dd267b1e719 --- /dev/null +++ b/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsAccessPolicy.md @@ -0,0 +1,225 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/remove-aztimeseriesinsightsaccesspolicy +schema: 2.0.0 +--- + +# Remove-AzTimeSeriesInsightsAccessPolicy + +## SYNOPSIS +Deletes the access policy with the specified name in the specified subscription, resource group, and environment + +## SYNTAX + +### Delete (Default) +``` +Remove-AzTimeSeriesInsightsAccessPolicy -EnvironmentName -Name -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzTimeSeriesInsightsAccessPolicy -InputObject + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes the access policy with the specified name in the specified subscription, resource group, and environment + +## EXAMPLES + +### Example 1: Remove a specified access policy by name +```powershell +PS C:\> Remove-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -Name policy001 -ResourceGroupName testgroup + +``` + +This command removes a specified access policy. + +### Example 2: Remove a specified access policy by object +```powershell +PS C:\> $policy = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -Name policy001 -ResourceGroupName testgroup +PS C:\> Remove-AzTimeSeriesInsightsAccessPolicy -InputObject $policy + +``` + +This command removes a specified access policy. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights access policy associated with the specified environment. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: AccessPolicyName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### System.Boolean + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsEnvironment.md b/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsEnvironment.md new file mode 100644 index 000000000000..606ab8675bad --- /dev/null +++ b/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsEnvironment.md @@ -0,0 +1,209 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/remove-aztimeseriesinsightsenvironment +schema: 2.0.0 +--- + +# Remove-AzTimeSeriesInsightsEnvironment + +## SYNOPSIS +Deletes the environment with the specified name in the specified subscription and resource group. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzTimeSeriesInsightsEnvironment -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzTimeSeriesInsightsEnvironment -InputObject [-DefaultProfile ] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes the environment with the specified name in the specified subscription and resource group. + +## EXAMPLES + +### Example 1: Remove a time series insights environment by name +```powershell +PS C:\> Remove-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsill + +``` + +This command removes a time series insights environment. + +### Example 2: Remove a time series insights environment by object +```powershell +PS C:\> $env = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsill +PS C:\> Remove-AzTimeSeriesInsightsEnvironment -InputObject $env + +``` + +This command removes a time series insights environment. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: EnvironmentName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### System.Boolean + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsEventSource.md b/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsEventSource.md new file mode 100644 index 000000000000..fd8d562d1889 --- /dev/null +++ b/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsEventSource.md @@ -0,0 +1,225 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/remove-aztimeseriesinsightseventsource +schema: 2.0.0 +--- + +# Remove-AzTimeSeriesInsightsEventSource + +## SYNOPSIS +Deletes the event source with the specified name in the specified subscription, resource group, and environment + +## SYNTAX + +### Delete (Default) +``` +Remove-AzTimeSeriesInsightsEventSource -EnvironmentName -Name -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzTimeSeriesInsightsEventSource -InputObject [-DefaultProfile ] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes the event source with the specified name in the specified subscription, resource group, and environment + +## EXAMPLES + +### Example 1: Remove a specified event source by name +```powershell +PS C:\> Remove-AzTimeSeriesInsightsEventSource -EnvironmentName tsitest001 -Name iots001 -ResourceGroupName testgroup + +``` + +This removes a specific event source. + +### Example 2: Remove a specified event source by object +```powershell +PS C:\> $es = Get-AzTimeSeriesInsightsEventSource -EnvironmentName tsitest001 -ResourceGroupName testgroup -Name iots001 +PS C:\> Remove-AzTimeSeriesInsightsEventSource -InputObject $es + +``` + +This removes a specific event source. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights event source associated with the specified environment. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: EventSourceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### System.Boolean + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsReferenceDataSet.md b/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsReferenceDataSet.md new file mode 100644 index 000000000000..b774b17dcb4a --- /dev/null +++ b/src/TimeSeriesInsights/docs/Remove-AzTimeSeriesInsightsReferenceDataSet.md @@ -0,0 +1,226 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/remove-aztimeseriesinsightsreferencedataset +schema: 2.0.0 +--- + +# Remove-AzTimeSeriesInsightsReferenceDataSet + +## SYNOPSIS +Deletes the reference data set with the specified name in the specified subscription, resource group, and environment + +## SYNTAX + +### Delete (Default) +``` +Remove-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName -Name + -ResourceGroupName [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-Confirm] + [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzTimeSeriesInsightsReferenceDataSet -InputObject + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes the reference data set with the specified name in the specified subscription, resource group, and environment + +## EXAMPLES + +### Example 1: Remove a specified reference data set by name +```powershell +PS C:\> Remove-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -Name dstest001 -ResourceGroupName testgroup + +``` + +This command removes a specified reference data set. + +### Example 2: Remove a specified reference data set by object +```powershell +PS C:\> $ds = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -Name dstest001 -ResourceGroupName testgroup +PS C:\> Remove-AzTimeSeriesInsightsReferenceDataSet -InputObject $ds + +``` + +This command removes a specified reference data set. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights reference data set associated with the specified environment. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: ReferenceDataSetName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### System.Boolean + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsAccessPolicy.md b/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsAccessPolicy.md new file mode 100644 index 000000000000..2d20d53a4dd5 --- /dev/null +++ b/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsAccessPolicy.md @@ -0,0 +1,248 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/update-aztimeseriesinsightsaccesspolicy +schema: 2.0.0 +--- + +# Update-AzTimeSeriesInsightsAccessPolicy + +## SYNOPSIS +Updates the access policy with the specified name in the specified subscription, resource group, and environment. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzTimeSeriesInsightsAccessPolicy -EnvironmentName -Name -ResourceGroupName + [-SubscriptionId ] [-Description ] [-Role ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzTimeSeriesInsightsAccessPolicy -InputObject [-Description ] + [-Role ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates the access policy with the specified name in the specified subscription, resource group, and environment. + +## EXAMPLES + +### Example 1: Update a specified access policy by name +```powershell +PS C:\> Update-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -Name policy001 -ResourceGroupName testgroup -Role Contributor,Reader + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command updates a specified access policy. + +### Example 2: Update a specified access policy by object +```powershell +PS C:\> $policy = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -ResourceGroupName $env.resourceGroup -Name policy001 +PS C:\> Update-AzTimeSeriesInsightsAccessPolicy -InputObject $policy -Role Contributor + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command updates a specified access policy. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Description +An description of the access policy. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights access policy associated with the specified environment. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: AccessPolicyName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Role +The list of roles the principal is assigned on the environment. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.AccessPolicyRole[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IAccessPolicyResource + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsEnvironment.md b/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsEnvironment.md new file mode 100644 index 000000000000..63ef1475949c --- /dev/null +++ b/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsEnvironment.md @@ -0,0 +1,376 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/update-aztimeseriesinsightsenvironment +schema: 2.0.0 +--- + +# Update-AzTimeSeriesInsightsEnvironment + +## SYNOPSIS +Updates the environment with the specified name in the specified subscription and resource group. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzTimeSeriesInsightsEnvironment -Name -ResourceGroupName [-SubscriptionId ] + [-Capacity ] [-DataRetentionTime ] [-PartitionKeyProperty ] + [-Sku ] [-StorageLimitExceededBehavior ] [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzTimeSeriesInsightsEnvironment -InputObject [-Capacity ] + [-DataRetentionTime ] [-PartitionKeyProperty ] [-Sku ] + [-StorageLimitExceededBehavior ] [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates the environment with the specified name in the specified subscription and resource group. + +## EXAMPLES + +### Example 1: Update a standard time series insights environment +```powershell +PS C:\> Update-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsitest001 -Capacity 5 -Sku S1 + +DataAccessFqdn : b6d113a4-0865-405f-b09e-ad4355b5d046.env.timeseries.azure.com +DataAccessId : b6d113a4-0865-405f-b09e-ad4355b5d046 +DataRetentionTime : 1.01:25:00 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest + 001 +IngressState : +Kind : Standard +Location : eastus +Name : tsitest001 +PartitionKeyProperty : +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 5 +SkuName : S1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageLimitExceededBehavior : PurgeOldData +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +Type : Microsoft.TimeSeriesInsights/Environments +``` + +This command updates a standard time series insights environment. + +### Example 2: Update a standard time series insights environment +```powershell +PS C:\> $env = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsitest001 +PS C:\> PS C:\> Update-AzTimeSeriesInsightsEnvironment -InputObject $env -Capacity 6 -Sku S1 + +DataAccessFqdn : b6d113a4-0865-405f-b09e-ad4355b5d046.env.timeseries.azure.com +DataAccessId : b6d113a4-0865-405f-b09e-ad4355b5d046 +DataRetentionTime : 1.01:25:00 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest + 001 +IngressState : +Kind : Standard +Location : eastus +Name : tsitest001 +PartitionKeyProperty : +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 6 +SkuName : S1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageLimitExceededBehavior : PurgeOldData +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +Type : Microsoft.TimeSeriesInsights/Environments +``` + +This command updates a standard time series insights environment. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Capacity +The capacity of the sku. +For standard environments, this value can be changed to support scale out of environments after they have been created. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -DataRetentionTime +ISO8601 timespan specifying the minimum number of days the environment's events will be available for query. + +```yaml +Type: System.TimeSpan +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: EnvironmentName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -PartitionKeyProperty +The list of event properties which will be used to partition data in the environment. +To construct, see NOTES section for PARTITIONKEYPROPERTY properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ITimeSeriesIdProperty[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Sku +The name of this SKU. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.SkuName +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -StorageLimitExceededBehavior +The behavior the Time Series Insights service should take when the environment's capacity has been exceeded. +If "PauseIngress" is specified, new events will not be read from the event source. +If "PurgeOldData" is specified, new events will continue to be read and old events will be deleted from the environment. +The default behavior is PurgeOldData. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.StorageLimitExceededBehavior +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Tag +Key-value pairs of additional properties for the environment. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IEnvironmentResource + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +#### PARTITIONKEYPROPERTY : The list of event properties which will be used to partition data in the environment. + - `[Name ]`: The name of the property. + - `[Type ]`: The type of the property. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsEventSource.md b/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsEventSource.md new file mode 100644 index 000000000000..a73e116fe2dd --- /dev/null +++ b/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsEventSource.md @@ -0,0 +1,248 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/update-aztimeseriesinsightseventsource +schema: 2.0.0 +--- + +# Update-AzTimeSeriesInsightsEventSource + +## SYNOPSIS +Updates the event source with the specified name in the specified subscription, resource group, and environment. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzTimeSeriesInsightsEventSource -EnvironmentName -Name -ResourceGroupName + [-SubscriptionId ] [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzTimeSeriesInsightsEventSource -InputObject [-Tag ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates the event source with the specified name in the specified subscription, resource group, and environment. + +## EXAMPLES + +### Example 1: Update a specified event source by name +```powershell +PS C:\> Update-AzTimeSeriesInsightsEventSource -EnvironmentName tsitest001 -Name iots001 -ResourceGroupName testgroup -Tag @{"tgk"="001"} + +ConsumerGroupName : testgroup2 +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup2/providers/Microsoft.Devices/IotHubs/iotname001 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest001/eventsources/iots001 +IotHubName : iotname001 +KeyName : RootManageSharedAccessKey +Kind : Microsoft.IoTHub +Location : eastus +Name : iots001 +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command updates a specific event source. + +### Example 3: Update a specified event source by object +```powershell +PS C:\>$es = Get-AzTimeSeriesInsightsEventSource -EnvironmentName tsitest001 -ResourceGroupName testgroup -Name iots001 +PS C:\> Update-AzTimeSeriesInsightsEventSource -InputObject -Tag @{"tgb"="002"} + +ConsumerGroupName : testgroup2 +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup2/providers/Microsoft.Devices/IotHubs/iotname001 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest001/eventsources/iots001 +IotHubName : iotname001 +KeyName : RootManageSharedAccessKey +Kind : Microsoft.IoTHub +Location : eastus +Name : iots001 +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command updates a specific event source. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights event source associated with the specified environment. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: EventSourceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Tag +Key-value pairs of additional properties for the event source. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IEventSourceResource + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsReferenceDataSet.md b/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsReferenceDataSet.md new file mode 100644 index 000000000000..d31f8bc3a0ba --- /dev/null +++ b/src/TimeSeriesInsights/docs/Update-AzTimeSeriesInsightsReferenceDataSet.md @@ -0,0 +1,232 @@ +--- +external help file: +Module Name: Az.TimeSeriesInsights +online version: https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/update-aztimeseriesinsightsreferencedataset +schema: 2.0.0 +--- + +# Update-AzTimeSeriesInsightsReferenceDataSet + +## SYNOPSIS +Updates the reference data set with the specified name in the specified subscription, resource group, and environment. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName -Name + -ResourceGroupName [-SubscriptionId ] [-Tag ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzTimeSeriesInsightsReferenceDataSet -InputObject [-Tag ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates the reference data set with the specified name in the specified subscription, resource group, and environment. + +## EXAMPLES + +### Example 1: Update a specified reference data set by name +```powershell +PS C:\> Update-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -Name dstest001 -ResourceGroupName testgroup -Tag @{"tstg"="lb001"} + +Location Name Type +-------- ---- ---- +eastus dstest001 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command updates a specified reference data set. + +### Example 2: Update a specified reference data set by object +```powershell +PS C:\> $ds = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -ResourceGroupName testgroup -ReferenceDataSetName dstest001 +PS C:\> Update-AzTimeSeriesInsightsReferenceDataSet -InputObject $ds -Tag @{"tstg"="lb001"} + +Location Name Type +-------- ---- ---- +eastus dstest001 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command updates a specified reference data set. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -EnvironmentName +The name of the Time Series Insights environment associated with the specified resource group. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +Dynamic: False +``` + +### -Name +The name of the Time Series Insights reference data set associated with the specified environment. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: ReferenceDataSetName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -ResourceGroupName +Name of an Azure Resource group. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Tag +Key-value pairs of additional properties for the reference data set. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +Dynamic: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.ITimeSeriesInsightsIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IReferenceDataSetResource + +## ALIASES + +## NOTES + +### COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +#### INPUTOBJECT : Identity Parameter + - `[AccessPolicyName ]`: Name of the access policy. + - `[EnvironmentName ]`: Name of the environment + - `[EventSourceName ]`: The name of the Time Series Insights event source associated with the specified environment. + - `[Id ]`: Resource identity path + - `[ReferenceDataSetName ]`: Name of the reference data set. + - `[ResourceGroupName ]`: Name of an Azure Resource group. + - `[SubscriptionId ]`: Azure Subscription ID. + +## RELATED LINKS + diff --git a/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsAccessPolicy.md b/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsAccessPolicy.md new file mode 100644 index 000000000000..a6180401ad1d --- /dev/null +++ b/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsAccessPolicy.md @@ -0,0 +1,34 @@ +### Example 1: List all access policies under a specified environment +```powershell +PS C:\> Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -ResourceGroupName testgroup + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +policy002 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command lists all access policies under a specified environment. + +### Example 2: Get a specified access policy by name +```powershell +PS C:\> Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -ResourceGroupName testgroup -Name policy001 + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command gets a specified access policy. + +### Example 3: Get a specified access policy by object +```powershell +PS C:\>$ap = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsi-envv8u56x -ResourceGroupName tsi-test-i01k5l -Name tsi-apilgj5y +PS C:\>Get-AzTimeSeriesInsightsAccessPolicy -InputObject $ap + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command gets a specified access policy. \ No newline at end of file diff --git a/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsEnvironment.md b/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsEnvironment.md new file mode 100644 index 000000000000..fbe15c40b7b0 --- /dev/null +++ b/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsEnvironment.md @@ -0,0 +1,108 @@ +### Example 1: Get a time series insights environment +```powershell +PS C:\> Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsitest001 + +DataAccessFqdn : b6d113a4-0865-405f-b09e-ad4355b5d046.env.timeseries.azure.com +DataAccessId : b6d113a4-0865-405f-b09e-ad4355b5d046 +DataRetentionTime : 1.01:25:00 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest + 001 +IngressState : +Kind : Standard +Location : eastus +Name : tsitest001 +PartitionKeyProperty : +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 2 +SkuName : S1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageLimitExceededBehavior : PurgeOldData +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +Type : Microsoft.TimeSeriesInsights/Environments +``` + +This command gets a time series insights environment. + +### Example 2: List all time series insights environments +```powershell +PS C:\> Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup + +DataAccessFqdn : 3de1d1e1-4f9b-4bc6-aad3-a835597dcd86.env.timeseries.azure.com +DataAccessId : 3de1d1e1-4f9b-4bc6-aad3-a835597dcd86 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/ + tsill +IngressState : +Kind : LongTerm +Location : EastUs +Name : tsill +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 1 +SkuName : L1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageConfigurationAccountName : cdolauli +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimeSeriesIdProperty : {ccc} +Type : Microsoft.TimeSeriesInsights/Environments +WarmStoreConfigurationDataRetention : 00:00:00 + +DataAccessFqdn : b6d113a4-0865-405f-b09e-ad4355b5d046.env.timeseries.azure.com +DataAccessId : b6d113a4-0865-405f-b09e-ad4355b5d046 +DataRetentionTime : 1.01:25:00 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest + 001 +IngressState : +Kind : Standard +Location : eastus +Name : tsitest001 +PartitionKeyProperty : +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 2 +SkuName : S1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageLimitExceededBehavior : PurgeOldData +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +Type : Microsoft.TimeSeriesInsights/Environments +``` + +This command lists all time series insights environments in a resource group. + +### Example 3: Get a time series insights environment by object +```powershell +PS C:\> $env = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName tsi-test-i01k5l -EnvironmentName tsi-envv8u56x +PS C:\> Get-AzTimeSeriesInsightsEnvironment -InputObject $env + +DataAccessFqdn : d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com +DataAccessId : d76a61f2-8a30-41a5-9587-f241eb9b48d9 +DataRetentionTime : 1.01:25:00 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x +IngressState : +Kind : Standard +Location : eastus2 +Name : tsi-envv8u56x +PartitionKeyProperty : +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 1 +SkuName : S1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageLimitExceededBehavior : PurgeOldData +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +Type : Microsoft.TimeSeriesInsights/Environments +``` + +This command gets a time series insights environments. diff --git a/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsEventSource.md b/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsEventSource.md new file mode 100644 index 000000000000..39c0250f6c0c --- /dev/null +++ b/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsEventSource.md @@ -0,0 +1,76 @@ +### Example 1: List all event sources under the specified environment +```powershell +PS C:\> Get-AzTimeSeriesInsightsEventSource -ResourceGroupName testgroup -EnvironmentName tsitest001 + +ConsumerGroupName : testgroup2 +EventHubName : hubname001 +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup2/providers/Microsoft.EventHub/namespaces/spacename001/eventhubs/hu + bname001 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest001/eve + ntsources/estest001 +KeyName : RootManageSharedAccessKey +Kind : Microsoft.EventHub +Location : eastus +Name : estest001 +ServiceBusNamespace : spacename001 +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources + +ConsumerGroupName : testgroup2 +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup2/providers/Microsoft.Devices/IotHubs/iotname001 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest001/eve + ntsources/iots001 +IotHubName : iotname001 +KeyName : RootManageSharedAccessKey +Kind : Microsoft.IoTHub +Location : eastus +Name : iots001 +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command lists all event sources under the specified environments. + +### Example 2: Get a specified event source by name +```powershell +PS C:\> Get-AzTimeSeriesInsightsEventSource -ResourceGroupName testgroup -EnvironmentName tsitest001 -Name iots001 + +ConsumerGroupName : testgroup2 +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup2/providers/Microsoft.Devices/IotHubs/iotname001 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest001/eve + ntsources/iots001 +IotHubName : iotname001 +KeyName : RootManageSharedAccessKey +Kind : Microsoft.IoTHub +Location : eastus +Name : iots001 +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command gets a specific event source. + +### Example 3: Get a specified event source by object +```powershell +PS C:\> $es = Get-AzTimeSeriesInsightsEventSource -ResourceGroupName tsi-test-i01k5l -EnvironmentName tsi-envv8u56x -Name tsi-esrfyi9h +PS C:\> Get-AzTimeSeriesInsightsEventSource -InputObject $es + +ConsumerGroupName : tsi-test-i01k5l +EventHubName : eventhubname-d2rvmp +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-0t3khp/eventhubs/eventhubname-d2rvmp +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h +KeyName : RootManageSharedAccessKey +Kind : Microsoft.EventHub +Location : eastus2 +Name : tsi-esrfyi9h +ServiceBusNamespace : eventhubspace-0t3khp +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command gets a specific event source. + diff --git a/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsReferenceDataSet.md b/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsReferenceDataSet.md new file mode 100644 index 000000000000..6bd1d0ac14cd --- /dev/null +++ b/src/TimeSeriesInsights/examples/Get-AzTimeSeriesInsightsReferenceDataSet.md @@ -0,0 +1,34 @@ +### Example 1: List all reference data sets under the specified environment +```powershell +PS C:\> Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dstest001 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +eastus dstest002 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command lists all reference data sets under the specified environment. + +### Example 2: Get a specified reference data set by name +```powershell +PS C:\> Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -ResourceGroupName testgroup -ReferenceDataSetName dstest001 + +Location Name Type +-------- ---- ---- +eastus dstest001 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command gets a specified reference data set. + +### Example 3: Get a specified reference data set by object +```powershell +PS C:\> $ds = Get-AzTimeSeriesInsightsReferenceDataSet -ResourceGroupName tsi-test-i01k5l -EnvironmentName tsi-envv8u56x -Name tsirdsqwufij +PS C:\>Get-AzTimeSeriesInsightsReferenceDataSet -InputObject $ds + +Location Name Type +-------- ---- ---- +eastus2 tsirdsqwufij Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command gets a specified reference data set. diff --git a/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsAccessPolicy.md b/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsAccessPolicy.md new file mode 100644 index 000000000000..090c9a3ff894 --- /dev/null +++ b/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsAccessPolicy.md @@ -0,0 +1,10 @@ +### Example 1: Create an access policy for a specified environment +```powershell +PS C:\> New-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -ResourceGroupName testgroup -PrincipalObjectId ce74a389-b5e8-4f16-89c7-787031ddd903 -Role Contributor -Name policy001 + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command creates an access policy for a specified environment. \ No newline at end of file diff --git a/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsEnvironment.md b/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsEnvironment.md new file mode 100644 index 000000000000..ca63b050201a --- /dev/null +++ b/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsEnvironment.md @@ -0,0 +1,25 @@ +### Example 1: Create a standard time series insights environment +```powershell +PS C:\> $TimeSpan = New-TimeSpan -Days 1 -Hours 1 -Minutes 25 +PS C:\> New-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsitest001 -Kind Standard -Location eastus -Sku S1 -DataRetentionTime $TimeSpan -Capacity 2 + +Kind Location Name SkuCapacity SkuName Type +---- -------- ---- ----------- ------- ---- +Standard eastus tsitest001 2 S1 Microsoft.TimeSeriesInsights/Environments +``` + +This command creates a standard time series insights environment. + +### Example 2: Create a longterm time series insights environment +```powershell +PS C:\> New-AzStorageAccount -ResourceGroupName testgroup -AccountName staccount001 -Location eastus -SkuName Standard_GRS +PS C:\> $ks = Get-AzStorageAccountKey -ResourceGroupName "testgroup" -Name "staccount001" +PS C:\> $k = $ks[0] | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsitest002 -Kind LongTerm -Location eastus -Sku L1 -StorageAccountName staccount001 -StorageAccountKey $k -TimeSeriesIdProperty @{name='cdc';type='string'} + +Kind Location Name SkuCapacity SkuName Type +---- -------- ---- ----------- ------- ---- +LongTerm eastus tsitest002 1 L1 Microsoft.TimeSeriesInsights/Environments +``` + +This command creates a longterm time series insights environment. diff --git a/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsEventSource.md b/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsEventSource.md new file mode 100644 index 000000000000..61191fa4a568 --- /dev/null +++ b/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsEventSource.md @@ -0,0 +1,29 @@ +### Example 1: Create an eventhub event source under the specified environment +```powershell +PS C:\> $ev = New-AzEventHub -ResourceGroupName testgroup2 -NamespaceName spacename001 -Name hubname001 -MessageRetentionInDays 3 -PartitionCount 2 +PS C:\> $ks = Get-AzEventHubKey -ResourceGroupName testgroup2 -NamespaceName spacename001 -AuthorizationRuleName RootManageSharedAccessKey +PS C:\> $k = $ks.PrimaryKey | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzTimeSeriesInsightsEventSource -ResourceGroupName testgroup -Name estest001 -EnvironmentName tsitest001 -Kind Microsoft.EventHub -ConsumerGroupName testgroup2 -Location eastus -KeyName RootManageSharedAccessKey -ServiceBusNameSpace spacename001 -EventHubName hubname001 -EventSourceResourceId $ev.id -SharedAccessKey $k + +Kind Location Name Type +---- -------- ---- ---- +Microsoft.EventHub eastus estest001 Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command creates an eventhub event source under the specified environment. + +### Example 2: Create an iothub event source under the specified environment +```powershell +PS C:\> $ev = New-AzIotHub -ResourceGroupName testgroup2 -Location eastus -Name iotname001 -SkuName S1 -Units 100 +PS C:\> $ks = Get-AzIotHubKey -ResourceGroupName testgroup2 -Name iotname001 +PS C:\> $k = $ks[0].PrimaryKey | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzTimeSeriesInsightsEventSource -ResourceGroupName testgroup -Name iots001 +-EnvironmentName tsitest001 -Kind Microsoft.IoTHub -ConsumerGroupName testgroup2 -Location eastus -KeyName RootManageSharedAccessKey -IoTHubName iotname001 -EventSourceResourceId $ev.id -SharedAccessKey $k + +Location Name Type Kind +-------- ---- ---- ---- +eastus iots001 Microsoft.TimeSeriesInsights/Environments/EventSources Microsoft.IoTHub +``` + +This command creates an iothub event source under the specified environment. + diff --git a/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsReferenceDataSet.md b/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsReferenceDataSet.md new file mode 100644 index 000000000000..a6c1ae864bd7 --- /dev/null +++ b/src/TimeSeriesInsights/examples/New-AzTimeSeriesInsightsReferenceDataSet.md @@ -0,0 +1,11 @@ +### Example 1: Create a reference data set for a specified environment +```powershell +PS C:\> $mykeyproperties = @{ "name" = "device01"; "type" = "Double"} +PS C:\> New-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -Name dstest001 -ResourceGroupName testgroup -Location eastus -DataStringComparisonBehavior Ordinal -KeyProperty $mykeyproperties + +Location Name Type +-------- ---- ---- +eastus dstest001 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command creates a reference data set for a specific environment. diff --git a/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsAccessPolicy.md b/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsAccessPolicy.md new file mode 100644 index 000000000000..ca6739bff314 --- /dev/null +++ b/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsAccessPolicy.md @@ -0,0 +1,18 @@ +### Example 1: Remove a specified access policy by name +```powershell +PS C:\> Remove-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -Name policy001 -ResourceGroupName testgroup + +``` + +This command removes a specified access policy. + +### Example 2: Remove a specified access policy by object +```powershell +PS C:\> $policy = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -Name policy001 -ResourceGroupName testgroup +PS C:\> Remove-AzTimeSeriesInsightsAccessPolicy -InputObject $policy + +``` + +This command removes a specified access policy. + + diff --git a/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsEnvironment.md b/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsEnvironment.md new file mode 100644 index 000000000000..2885ec91c6bd --- /dev/null +++ b/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsEnvironment.md @@ -0,0 +1,17 @@ +### Example 1: Remove a time series insights environment by name +```powershell +PS C:\> Remove-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsill + +``` + +This command removes a time series insights environment. + +### Example 2: Remove a time series insights environment by object +```powershell +PS C:\> $env = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsill +PS C:\> Remove-AzTimeSeriesInsightsEnvironment -InputObject $env + +``` + +This command removes a time series insights environment. + diff --git a/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsEventSource.md b/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsEventSource.md new file mode 100644 index 000000000000..4bdb1a799df2 --- /dev/null +++ b/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsEventSource.md @@ -0,0 +1,17 @@ +### Example 1: Remove a specified event source by name +```powershell +PS C:\> Remove-AzTimeSeriesInsightsEventSource -EnvironmentName tsitest001 -Name iots001 -ResourceGroupName testgroup + +``` + +This removes a specific event source. + +### Example 2: Remove a specified event source by object +```powershell +PS C:\> $es = Get-AzTimeSeriesInsightsEventSource -EnvironmentName tsitest001 -ResourceGroupName testgroup -Name iots001 +PS C:\> Remove-AzTimeSeriesInsightsEventSource -InputObject $es + +``` + +This removes a specific event source. + diff --git a/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsReferenceDataSet.md b/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsReferenceDataSet.md new file mode 100644 index 000000000000..9e8dddf6b01b --- /dev/null +++ b/src/TimeSeriesInsights/examples/Remove-AzTimeSeriesInsightsReferenceDataSet.md @@ -0,0 +1,16 @@ +### Example 1: Remove a specified reference data set by name +```powershell +PS C:\> Remove-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -Name dstest001 -ResourceGroupName testgroup + +``` + +This command removes a specified reference data set. + +### Example 2: Remove a specified reference data set by object +```powershell +PS C:\> $ds = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -Name dstest001 -ResourceGroupName testgroup +PS C:\> Remove-AzTimeSeriesInsightsReferenceDataSet -InputObject $ds + +``` + +This command removes a specified reference data set. diff --git a/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsAccessPolicy.md b/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsAccessPolicy.md new file mode 100644 index 000000000000..34c2d942d3eb --- /dev/null +++ b/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsAccessPolicy.md @@ -0,0 +1,22 @@ +### Example 1: Update a specified access policy by name +```powershell +PS C:\> Update-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -Name policy001 -ResourceGroupName testgroup -Role Contributor,Reader + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command updates a specified access policy. + +### Example 2: Update a specified access policy by object +```powershell +PS C:\> $policy = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName tsitest001 -ResourceGroupName $env.resourceGroup -Name policy001 +PS C:\> Update-AzTimeSeriesInsightsAccessPolicy -InputObject $policy -Role Contributor + +Name Type +---- ---- +policy001 Microsoft.TimeSeriesInsights/Environments/AccessPolicies +``` + +This command updates a specified access policy. \ No newline at end of file diff --git a/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsEnvironment.md b/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsEnvironment.md new file mode 100644 index 000000000000..e2cb7f3c8cbf --- /dev/null +++ b/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsEnvironment.md @@ -0,0 +1,59 @@ +### Example 1: Update a standard time series insights environment +```powershell +PS C:\> Update-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsitest001 -Capacity 5 -Sku S1 + +DataAccessFqdn : b6d113a4-0865-405f-b09e-ad4355b5d046.env.timeseries.azure.com +DataAccessId : b6d113a4-0865-405f-b09e-ad4355b5d046 +DataRetentionTime : 1.01:25:00 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest + 001 +IngressState : +Kind : Standard +Location : eastus +Name : tsitest001 +PartitionKeyProperty : +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 5 +SkuName : S1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageLimitExceededBehavior : PurgeOldData +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +Type : Microsoft.TimeSeriesInsights/Environments +``` + +This command updates a standard time series insights environment. + +### Example 2: Update a standard time series insights environment +```powershell +PS C:\> $env = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName testgroup -Name tsitest001 +PS C:\> PS C:\> Update-AzTimeSeriesInsightsEnvironment -InputObject $env -Capacity 6 -Sku S1 + +DataAccessFqdn : b6d113a4-0865-405f-b09e-ad4355b5d046.env.timeseries.azure.com +DataAccessId : b6d113a4-0865-405f-b09e-ad4355b5d046 +DataRetentionTime : 1.01:25:00 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest + 001 +IngressState : +Kind : Standard +Location : eastus +Name : tsitest001 +PartitionKeyProperty : +PropertyUsageState : +Sku : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.Sku +SkuCapacity : 6 +SkuName : S1 +StateDetailCode : +StateDetailCurrentCount : +StateDetailMaxCount : +StateDetailMessage : +StorageLimitExceededBehavior : PurgeOldData +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +Type : Microsoft.TimeSeriesInsights/Environments +``` + +This command updates a standard time series insights environment. + diff --git a/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsEventSource.md b/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsEventSource.md new file mode 100644 index 000000000000..13d0ddea141f --- /dev/null +++ b/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsEventSource.md @@ -0,0 +1,39 @@ +### Example 1: Update a specified event source by name +```powershell +PS C:\> Update-AzTimeSeriesInsightsEventSource -EnvironmentName tsitest001 -Name iots001 -ResourceGroupName testgroup -Tag @{"tgk"="001"} + +ConsumerGroupName : testgroup2 +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup2/providers/Microsoft.Devices/IotHubs/iotname001 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest001/eventsources/iots001 +IotHubName : iotname001 +KeyName : RootManageSharedAccessKey +Kind : Microsoft.IoTHub +Location : eastus +Name : iots001 +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command updates a specific event source. + +### Example 3: Update a specified event source by object +```powershell +PS C:\>$es = Get-AzTimeSeriesInsightsEventSource -EnvironmentName tsitest001 -ResourceGroupName testgroup -Name iots001 +PS C:\> Update-AzTimeSeriesInsightsEventSource -InputObject -Tag @{"tgb"="002"} + +ConsumerGroupName : testgroup2 +EventSourceResourceId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup2/providers/Microsoft.Devices/IotHubs/iotname001 +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroup/providers/Microsoft.TimeSeriesInsights/environments/tsitest001/eventsources/iots001 +IotHubName : iotname001 +KeyName : RootManageSharedAccessKey +Kind : Microsoft.IoTHub +Location : eastus +Name : iots001 +Tag : Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.TrackedResourceTags +TimestampPropertyName : +Type : Microsoft.TimeSeriesInsights/Environments/EventSources +``` + +This command updates a specific event source. + diff --git a/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsReferenceDataSet.md b/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsReferenceDataSet.md new file mode 100644 index 000000000000..062eb40ecae7 --- /dev/null +++ b/src/TimeSeriesInsights/examples/Update-AzTimeSeriesInsightsReferenceDataSet.md @@ -0,0 +1,23 @@ +### Example 1: Update a specified reference data set by name +```powershell +PS C:\> Update-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -Name dstest001 -ResourceGroupName testgroup -Tag @{"tstg"="lb001"} + +Location Name Type +-------- ---- ---- +eastus dstest001 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command updates a specified reference data set. + +### Example 2: Update a specified reference data set by object +```powershell +PS C:\> $ds = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName tsitest001 -ResourceGroupName testgroup -ReferenceDataSetName dstest001 +PS C:\> Update-AzTimeSeriesInsightsReferenceDataSet -InputObject $ds -Tag @{"tstg"="lb001"} + +Location Name Type +-------- ---- ---- +eastus dstest001 Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets +``` + +This command updates a specified reference data set. + diff --git a/src/TimeSeriesInsights/readme.md b/src/TimeSeriesInsights/readme.md new file mode 100644 index 000000000000..bb18d5bfb834 --- /dev/null +++ b/src/TimeSeriesInsights/readme.md @@ -0,0 +1,129 @@ + +# Az.TimeSeriesInsights +This directory contains the PowerShell module for the TimeSeriesInsights service. + +--- +## Status +[![Az.TimeSeriesInsights](https://img.shields.io/powershellgallery/v/Az.TimeSeriesInsights.svg?style=flat-square&label=Az.TimeSeriesInsights "Az.TimeSeriesInsights")](https://www.powershellgallery.com/packages/Az.TimeSeriesInsights/) + +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 1.7.2 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.TimeSeriesInsights`, see [how-to.md](how-to.md). + + +--- +## Generation Requirements +Use of the beta version of `autorest.powershell` generator requires the following: +- [NodeJS LTS](https://nodejs.org) (10.15.x LTS preferred) + - **Note**: It *will not work* with Node < 10.x. Using 11.x builds may cause issues as they may introduce instability or breaking changes. +> If you want an easy way to install and update Node, [NVS - Node Version Switcher](../nodejs/installing-via-nvs.md) or [NVM - Node Version Manager](../nodejs/installing-via-nvm.md) is recommended. +- [AutoRest](https://aka.ms/autorest) v3 beta
`npm install -g autorest@autorest`
  +- PowerShell 6.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g pwsh`
  +- .NET Core SDK 2.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g dotnet-sdk-2.2`
  + +## Run Generation +In this directory, run AutoRest: +> `autorest-beta` + +--- +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(repo)/specification/timeseriesinsights/resource-manager/Microsoft.TimeSeriesInsights/preview/2018-08-15-preview/timeseriesinsights.json + +module-version: 0.0.1 +title: TimeSeriesInsights +subject-prefix: $(service-name) + +directive: + # Fix errors in swagger + - from: swagger-document + where: $ + transform: return $.replace(/Microsoft.IotHub/g, "Microsoft.IoTHub") + - from: swagger-document + where: $ + transform: return $.replace(/\/eventSources\//g, "/eventsources/") + - from: swagger-document + where: $ + transform: return $.replace(/\/accessPolicies\//g, "/accesspolicies/") + # Remove the unneeded parameter set + - where: + variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$ + remove: true + - where: + subject: ReferenceDataSet|AccessPolicy + variant: ^Create$ + remove: true + - where: + subject: EventSource|Environment + variant: ^Create$|^CreateExpanded$ + hide: true + # Remove the set-* cmdlet + - where: + verb: Set + remove: true + # Hide the operation cmdlet + - where: + subject: Operation + hide: true + # correct some names + - where: + parameter-name: SkuCapacity + set: + parameter-name: Capacity + - where: + parameter-name: SkuName + set: + parameter-name: Sku + # Suppress the table format + - where: + model-name: StandardEnvironmentResource + set: + suppress-format: true + - where: + model-name: LongTermEnvironmentResource + set: + suppress-format: true + - where: + model-name: EventHubEventSourceResource + set: + suppress-format: true + - where: + model-name: IoTHubEventSourceResource + set: + suppress-format: true + # Correct some generated code + - from: source-file-csharp + where: $ + transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IStandardEnvironmentCreationProperties Property', 'public Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IStandardEnvironmentCreationProperties Property'); + - from: source-file-csharp + where: $ + transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ILongTermEnvironmentCreationProperties Property', 'public Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ILongTermEnvironmentCreationProperties Property'); + - from: source-file-csharp + where: $ + transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IEventHubEventSourceCreationProperties Property', 'public Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IEventHubEventSourceCreationProperties Property'); + - from: source-file-csharp + where: $ + transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IIoTHubEventSourceCreationProperties Property', 'public Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IIoTHubEventSourceCreationProperties Property'); +``` diff --git a/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsAccessPolicy.Recording.json b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsAccessPolicy.Recording.json new file mode 100644 index 000000000000..0e6a2ecfed18 --- /dev/null +++ b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsAccessPolicy.Recording.json @@ -0,0 +1,158 @@ +{ + "Get-AzTimeSeriesInsightsAccessPolicy+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accessPolicies?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accessPolicies?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "43a95d81-8888-475a-aa15-2aaa9edb07c5" ], + "CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11997" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "9dd93a04-01ac-46e5-a60e-0613ff5f1ef9" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "3c596e62-a417-48dd-89f5-925612ce7f01" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073512Z:3c596e62-a417-48dd-89f5-925612ce7f01" ], + "Date": [ "Wed, 08 Apr 2020 07:35:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "378" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y\",\"name\":\"tsi-apilgj5y\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}]}" + } + }, + "Get-AzTimeSeriesInsightsAccessPolicy+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "7f9ea9c6-9499-4ac6-b69c-47caea071c69" ], + "CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11996" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "4e570a3b-7ef8-4e92-bc85-1a304fc1b7ad" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "33bc8732-8f81-471f-b02b-a893dbca4a58" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073513Z:33bc8732-8f81-471f-b02b-a893dbca4a58" ], + "Date": [ "Wed, 08 Apr 2020 07:35:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "366" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y\",\"name\":\"tsi-apilgj5y\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}" + } + }, + "Get-AzTimeSeriesInsightsAccessPolicy+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "938241e6-1d67-41de-8013-ef3b8862623d" ], + "CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11995" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "ddb81be1-791e-4328-b7de-f4eddeb7aef2" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "9ccdca19-7968-445f-af09-6bae6e30c62c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073513Z:9ccdca19-7968-445f-af09-6bae6e30c62c" ], + "Date": [ "Wed, 08 Apr 2020 07:35:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "366" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y\",\"name\":\"tsi-apilgj5y\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}" + } + }, + "Get-AzTimeSeriesInsightsAccessPolicy+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "251bd013-47d0-4add-ac44-93ab72055515" ], + "CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11994" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "4edea34a-8fc7-40df-b0eb-0cad54d981e8" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "d100fd2f-72a3-489a-affa-304b5478a38e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073514Z:d100fd2f-72a3-489a-affa-304b5478a38e" ], + "Date": [ "Wed, 08 Apr 2020 07:35:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "366" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y\",\"name\":\"tsi-apilgj5y\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 new file mode 100644 index 000000000000..fe5575581069 --- /dev/null +++ b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzTimeSeriesInsightsAccessPolicy.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzTimeSeriesInsightsAccessPolicy' { + It 'List' { + $policyList = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup + $policyList.Count | Should -Be 1 + } + + It 'Get' { + $policy = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup -Name $env.accessPolicy + $policy.Name | Should -Be $env.accessPolicy + } + + It 'GetViaIdentity' { + $policy01 = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup -Name $env.accessPolicy + $policy = Get-AzTimeSeriesInsightsAccessPolicy -InputObject $policy01 + $policy.Name | Should -Be $env.accessPolicy + } +} diff --git a/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEnvironment.Recording.json b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEnvironment.Recording.json new file mode 100644 index 000000000000..cd162c136057 --- /dev/null +++ b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEnvironment.Recording.json @@ -0,0 +1,158 @@ +{ + "Get-AzTimeSeriesInsightsEnvironment+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "a0b22ff7-576b-4f30-ae75-1c678b4473fa" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11993" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "97b9236e-2f64-4f4c-b3f5-713747655d46" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "95fcae78-7412-4504-9345-848997f18ab1" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073514Z:95fcae78-7412-4504-9345-848997f18ab1" ], + "Date": [ "Wed, 08 Apr 2020 07:35:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1407" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:30:17 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9\",\"dataAccessFqdn\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x\",\"name\":\"tsi-envv8u56x\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"},{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountxvtbjq\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:30:54 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3\",\"dataAccessFqdn\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk\",\"name\":\"tsi-envui70dk\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}]}" + } + }, + "Get-AzTimeSeriesInsightsEnvironment+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "42de3a21-4272-4909-9cc7-d89261616cba" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11992" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "a69af916-c333-4248-a3e2-7ffd9cfc7321" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "5fd2125d-6d9f-4563-bd0c-787a10fbb5e4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073515Z:5fd2125d-6d9f-4563-bd0c-787a10fbb5e4" ], + "Date": [ "Wed, 08 Apr 2020 07:35:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "693" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:30:17 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9\",\"dataAccessFqdn\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x\",\"name\":\"tsi-envv8u56x\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Get-AzTimeSeriesInsightsEnvironment+[NoContext]+InputObject+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "197c8425-687c-48b9-8c9e-3a363daf393b" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11991" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "47f74274-ffa5-485a-9b1c-e9e3b8ad7217" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "804d1b6c-ad51-4712-8dd9-56eefd3f1bbc" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073515Z:804d1b6c-ad51-4712-8dd9-56eefd3f1bbc" ], + "Date": [ "Wed, 08 Apr 2020 07:35:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "701" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountxvtbjq\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:30:54 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3\",\"dataAccessFqdn\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk\",\"name\":\"tsi-envui70dk\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Get-AzTimeSeriesInsightsEnvironment+[NoContext]+InputObject+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "9b9f911f-a225-49a2-abbd-f5d6ab4be22e" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11990" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "6c17f8c2-fe96-4c6c-b3ff-81828ae84769" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "d4f15e14-a389-4e4b-8186-8d9a82eee662" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073516Z:d4f15e14-a389-4e4b-8186-8d9a82eee662" ], + "Date": [ "Wed, 08 Apr 2020 07:35:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "701" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountxvtbjq\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:30:54 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3\",\"dataAccessFqdn\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk\",\"name\":\"tsi-envui70dk\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEnvironment.Tests.ps1 b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEnvironment.Tests.ps1 new file mode 100644 index 000000000000..5cdb1d4a6539 --- /dev/null +++ b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEnvironment.Tests.ps1 @@ -0,0 +1,29 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzTimeSeriesInsightsEnvironment.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzTimeSeriesInsightsEnvironment' { + It 'List' { + $tsiList = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup + $tsiList.Count | Should -Be 2 + } + + It 'Get' { + $tsiEnv = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $env.tsiEnvName + $tsiEnv.Name | Should -Be $env.tsiEnvName + } + It 'InputObject' { + $tsiEnv01 = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $env.tsiEnvName01 + $tsiEnv = Get-AzTimeSeriesInsightsEnvironment -InputObject $tsiEnv01 + $tsiEnv.Name | Should -Be $env.tsiEnvName01 + } +} diff --git a/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEventSource.Recording.json b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEventSource.Recording.json new file mode 100644 index 000000000000..96e640ac4307 --- /dev/null +++ b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEventSource.Recording.json @@ -0,0 +1,158 @@ +{ + "Get-AzTimeSeriesInsightsEventSource+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventSources?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventSources?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "9" ], + "x-ms-client-request-id": [ "357c50cb-8ba2-467e-9500-4fea036f1cc5" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEventSource_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11989" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "fc15b5dd-dcca-43a3-87fc-7cba5df9c4f3" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "68f07b8e-cd20-4a81-854f-4be9af5ac80f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073517Z:68f07b8e-cd20-4a81-854f-4be9af5ac80f" ], + "Date": [ "Wed, 08 Apr 2020 07:35:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "794" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"kind\":\"Microsoft.EventHub\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-0t3khp/eventhubs/eventhubname-d2rvmp\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"eventHubName\":\"eventhubname-d2rvmp\",\"keyName\":\"RootManageSharedAccessKey\",\"serviceBusNamespace\":\"eventhubspace-0t3khp\",\"creationTime\":\"Wed, 08 Apr 2020 07:31:30 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h\",\"name\":\"tsi-esrfyi9h\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}]}" + } + }, + "Get-AzTimeSeriesInsightsEventSource+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "10" ], + "x-ms-client-request-id": [ "b7856219-7a4b-45d9-b70c-efcaf85a658d" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEventSource_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11988" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "006853fa-c33c-4707-bf07-31b8e7623031" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "43e272aa-3bd0-4b52-9da5-784129d6d723" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073517Z:43e272aa-3bd0-4b52-9da5-784129d6d723" ], + "Date": [ "Wed, 08 Apr 2020 07:35:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "782" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"kind\":\"Microsoft.EventHub\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-0t3khp/eventhubs/eventhubname-d2rvmp\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"eventHubName\":\"eventhubname-d2rvmp\",\"keyName\":\"RootManageSharedAccessKey\",\"serviceBusNamespace\":\"eventhubspace-0t3khp\",\"creationTime\":\"Wed, 08 Apr 2020 07:31:30 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h\",\"name\":\"tsi-esrfyi9h\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}" + } + }, + "Get-AzTimeSeriesInsightsEventSource+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "11" ], + "x-ms-client-request-id": [ "13b8e20a-0557-4ab4-88e4-aa8c7ae696d7" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEventSource_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11987" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "6004f88f-f203-4028-9a05-37fd2a917d3e" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "f6f9eeb2-15a9-4599-8866-a26e90679655" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073518Z:f6f9eeb2-15a9-4599-8866-a26e90679655" ], + "Date": [ "Wed, 08 Apr 2020 07:35:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "782" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"kind\":\"Microsoft.EventHub\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-0t3khp/eventhubs/eventhubname-d2rvmp\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"eventHubName\":\"eventhubname-d2rvmp\",\"keyName\":\"RootManageSharedAccessKey\",\"serviceBusNamespace\":\"eventhubspace-0t3khp\",\"creationTime\":\"Wed, 08 Apr 2020 07:31:30 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h\",\"name\":\"tsi-esrfyi9h\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}" + } + }, + "Get-AzTimeSeriesInsightsEventSource+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "12" ], + "x-ms-client-request-id": [ "f2af4360-02b6-4c23-a424-55a21e1d5ef1" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEventSource_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11986" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "16de39f3-bd6d-412e-85d0-602fe715a9bc" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "8a8f5d30-551c-422b-98a7-ed36987e1ce6" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073518Z:8a8f5d30-551c-422b-98a7-ed36987e1ce6" ], + "Date": [ "Wed, 08 Apr 2020 07:35:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "782" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"kind\":\"Microsoft.EventHub\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-0t3khp/eventhubs/eventhubname-d2rvmp\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"eventHubName\":\"eventhubname-d2rvmp\",\"keyName\":\"RootManageSharedAccessKey\",\"serviceBusNamespace\":\"eventhubspace-0t3khp\",\"creationTime\":\"Wed, 08 Apr 2020 07:31:30 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h\",\"name\":\"tsi-esrfyi9h\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEventSource.Tests.ps1 b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEventSource.Tests.ps1 new file mode 100644 index 000000000000..421d0fc75dfd --- /dev/null +++ b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsEventSource.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzTimeSeriesInsightsEventSource.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzTimeSeriesInsightsEventSource' { + It 'List' { + $tsiEventSorceList = Get-AzTimeSeriesInsightsEventSource -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup + $tsiEventSorceList.Count | Should -Be 1 + } + + It 'Get' { + $getTsiEventSorce = Get-AzTimeSeriesInsightsEventSource -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup -Name $env.tsiEsName + $getTsiEventSorce.Name | Should -Be $env.tsiEsName + } + + It 'GetViaIdentity' { + $getTsiEventSorce01 = Get-AzTimeSeriesInsightsEventSource -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup -Name $env.tsiEsName + $getTsiEventSorce = Get-AzTimeSeriesInsightsEventSource -InputObject $getTsiEventSorce01 + $getTsiEventSorce.Name | Should -Be $getTsiEventSorce01.Name + } +} diff --git a/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsReferenceDataSet.Recording.json b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsReferenceDataSet.Recording.json new file mode 100644 index 000000000000..551e9cbbc676 --- /dev/null +++ b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsReferenceDataSet.Recording.json @@ -0,0 +1,158 @@ +{ + "Get-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "13" ], + "x-ms-client-request-id": [ "e041b3bb-074e-49dd-b411-5d570c9e0cb7" ], + "CommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11985" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "2689e36d-ec9d-48d2-856a-e9706981c545" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "29bcb083-7a05-43f5-8e64-3869cd75f7bf" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073519Z:29bcb083-7a05-43f5-8e64-3869cd75f7bf" ], + "Date": [ "Wed, 08 Apr 2020 07:35:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "513" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:31:41 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij\",\"name\":\"tsirdsqwufij\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}]}" + } + }, + "Get-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "14" ], + "x-ms-client-request-id": [ "62ddff1d-74bc-439f-8be4-f8b8c29b7676" ], + "CommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11984" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "1855ac52-5e18-46cc-9dda-2a17c384381e" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "58ea6e05-b48c-4ad3-a42b-99847ca4f1fc" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073519Z:58ea6e05-b48c-4ad3-a42b-99847ca4f1fc" ], + "Date": [ "Wed, 08 Apr 2020 07:35:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "501" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:31:41 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij\",\"name\":\"tsirdsqwufij\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}" + } + }, + "Get-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "15" ], + "x-ms-client-request-id": [ "06f0528e-f079-45ba-b5a4-6a6d63f3a303" ], + "CommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11983" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "7b0a62d5-d1c6-4bbe-8f25-8c56904b5311" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "5aac1a36-889e-4a55-9245-e873e0245b81" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073520Z:5aac1a36-889e-4a55-9245-e873e0245b81" ], + "Date": [ "Wed, 08 Apr 2020 07:35:20 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "501" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:31:41 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij\",\"name\":\"tsirdsqwufij\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}" + } + }, + "Get-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "16" ], + "x-ms-client-request-id": [ "75fad7cc-6f93-4a09-8f82-9548465deccc" ], + "CommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11982" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "07a55bbc-baa0-4b8f-8b8c-944842e32614" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "b436c3d5-3403-40d2-9dd0-2f5d39f3008f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073520Z:b436c3d5-3403-40d2-9dd0-2f5d39f3008f" ], + "Date": [ "Wed, 08 Apr 2020 07:35:20 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "501" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:31:41 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij\",\"name\":\"tsirdsqwufij\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 new file mode 100644 index 000000000000..af93528ca384 --- /dev/null +++ b/src/TimeSeriesInsights/test/Get-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzTimeSeriesInsightsReferenceDataSet.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzTimeSeriesInsightsReferenceDataSet' { + It 'List' { + $tsiDsList = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup + $tsiDsList.Count | Should -Be 1 + } + + It 'Get' { + $tsiDs = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup -ReferenceDataSetName $env.referenceDataSet + $tsiDs.Name | Should -be $env.referenceDataSet + } + + It 'GetViaIdentity' { + $tsiDs01 = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup -ReferenceDataSetName $env.referenceDataSet + $tsiDs = Get-AzTimeSeriesInsightsReferenceDataSet -InputObject $tsiDs01 + $tsiDs.Name | Should -be $env.referenceDataSet + } +} diff --git a/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsAccessPolicy.Recording.json b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsAccessPolicy.Recording.json new file mode 100644 index 000000000000..c6933312ba29 --- /dev/null +++ b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsAccessPolicy.Recording.json @@ -0,0 +1,201 @@ +{ + "New-AzTimeSeriesInsightsAccessPolicy+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1?api-version=2018-08-15-preview", + "Content": "{\n \"location\": \"eastus2\",\n \"sku\": {\n \"name\": \"S1\",\n \"capacity\": 2\n },\n \"kind\": \"Standard\",\n \"properties\": {\n \"dataRetentionTime\": \"P1DT1H25M\"\n }\n}", + "Headers": { + "x-ms-unique-id": [ "17" ], + "x-ms-client-request-id": [ "b577d100-bd29-4b92-8a8b-76bd584b6dce" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "161" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "69e57506-f1d8-4c7e-969d-5e7c0a84d63d" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "9c29185b-bfdc-4088-a278-32b082dd66a7" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073527Z:9c29185b-bfdc-4088-a278-32b082dd66a7" ], + "Date": [ "Wed, 08 Apr 2020 07:35:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "654" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"2020-04-08T07:35:25+00:00\",\"provisioningState\":\"Accepted\",\"dataAccessId\":\"64b41593-f9cb-4804-8f18-8d542f304af0\",\"dataAccessFqdn\":\"64b41593-f9cb-4804-8f18-8d542f304af0.env.timeseries.azure.com\",\"requestApiVersion\":\"2018-08-15-preview\",\"storageLimitExceededBehavior\":\"PurgeOldData\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1\",\"name\":\"rstr-8uxmh1\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsAccessPolicy+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18" ], + "x-ms-client-request-id": [ "b577d100-bd29-4b92-8a8b-76bd584b6dce", "b577d100-bd29-4b92-8a8b-76bd584b6dce" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11981" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "aa03c65c-92fa-4375-9553-eeb149de6eea" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "0b88b9ed-2931-47d8-b348-237c90ef172c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073558Z:0b88b9ed-2931-47d8-b348-237c90ef172c" ], + "Date": [ "Wed, 08 Apr 2020 07:35:57 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "689" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:35:25 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"64b41593-f9cb-4804-8f18-8d542f304af0\",\"dataAccessFqdn\":\"64b41593-f9cb-4804-8f18-8d542f304af0.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1\",\"name\":\"rstr-8uxmh1\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsAccessPolicy+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18", "19" ], + "x-ms-client-request-id": [ "b577d100-bd29-4b92-8a8b-76bd584b6dce", "b577d100-bd29-4b92-8a8b-76bd584b6dce", "b577d100-bd29-4b92-8a8b-76bd584b6dce" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11980" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "35becc17-bcdf-4e18-9cb9-8ad0d20e1824" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "74ae624f-674b-468a-932a-6580c79e0fdc" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073558Z:74ae624f-674b-468a-932a-6580c79e0fdc" ], + "Date": [ "Wed, 08 Apr 2020 07:35:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "689" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:35:25 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"64b41593-f9cb-4804-8f18-8d542f304af0\",\"dataAccessFqdn\":\"64b41593-f9cb-4804-8f18-8d542f304af0.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1\",\"name\":\"rstr-8uxmh1\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsAccessPolicy+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/accesspolicies/rstr-hszj9q?api-version=2018-08-15-preview+4": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/accesspolicies/rstr-hszj9q?api-version=2018-08-15-preview", + "Content": "{\n \"properties\": {\n \"principalObjectId\": \"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\n \"roles\": [ \"Reader\" ]\n }\n}", + "Headers": { + "x-ms-unique-id": [ "20" ], + "x-ms-client-request-id": [ "48acf812-9cca-417a-bed1-ed8286c17500" ], + "CommandName": [ "New-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsAccessPolicy_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "116" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "de230ae3-5e83-4b0c-9d0b-3fc01dcd0291" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "95196c44-6007-4eb2-9af5-21bb9cee0052" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073559Z:95196c44-6007-4eb2-9af5-21bb9cee0052" ], + "Date": [ "Wed, 08 Apr 2020 07:35:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "362" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/accesspolicies/rstr-hszj9q\",\"name\":\"rstr-hszj9q\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}" + } + }, + "New-AzTimeSeriesInsightsAccessPolicy+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/accesspolicies/rstr-hszj9q?api-version=2018-08-15-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/accesspolicies/rstr-hszj9q?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "21" ], + "x-ms-client-request-id": [ "ed61ad34-856d-4632-9740-2e2db4e76b5c" ], + "CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11979" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "1ea2e27e-6bd2-44fc-85d2-e2a67551b521" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "4337935d-38e0-46e0-8486-9f3c24f72e0c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073559Z:4337935d-38e0-46e0-8486-9f3c24f72e0c" ], + "Date": [ "Wed, 08 Apr 2020 07:35:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "362" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/accesspolicies/rstr-hszj9q\",\"name\":\"rstr-hszj9q\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 new file mode 100644 index 000000000000..ad30e692a18b --- /dev/null +++ b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) + +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzTimeSeriesInsightsAccessPolicy.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzTimeSeriesInsightsAccessPolicy' { + It 'CreateExpanded' { + $kind = 'Standard' + $sku01 = 'S1' + $timeSpan = New-TimeSpan -Days 1 -Hours 1 -Minutes 25 + $capacity = 2 + $environmentName = $env.rstrenv01 + New-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $environmentName -Kind $kind -Location $env.location -Sku $sku01 -DataRetentionTime $timeSpan -Capacity $capacity + + $role = 'Reader' + $accessPolicyName = $env.rstrap01 + New-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $environmentName -ResourceGroupName $env.resourceGroup -PrincipalObjectId $env.principalObjectId -Role $role -Name $env.rstrap01 + $policy = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $environmentName -ResourceGroupName $env.resourceGroup -Name $accessPolicyName + $policy.Name | Should -Be $accessPolicyName + } +} diff --git a/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEnvironment.Recording.json b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEnvironment.Recording.json new file mode 100644 index 000000000000..5eaf2ee395fb --- /dev/null +++ b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEnvironment.Recording.json @@ -0,0 +1,476 @@ +{ + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+standard+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview", + "Content": "{\n \"location\": \"eastus2\",\n \"sku\": {\n \"name\": \"S1\",\n \"capacity\": 2\n },\n \"kind\": \"Standard\",\n \"properties\": {\n \"dataRetentionTime\": \"P1DT1H25M\"\n }\n}", + "Headers": { + "x-ms-unique-id": [ "22" ], + "x-ms-client-request-id": [ "efbd3321-c9c4-462f-9cf1-456a1daaa660" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "161" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1197" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "485508c6-3e41-4e73-bae4-1104886e934e" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "c5e8553c-8cd5-4dfe-8553-39d23089f62e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073603Z:c5e8553c-8cd5-4dfe-8553-39d23089f62e" ], + "Date": [ "Wed, 08 Apr 2020 07:36:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "654" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"2020-04-08T07:36:02+00:00\",\"provisioningState\":\"Accepted\",\"dataAccessId\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba\",\"dataAccessFqdn\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba.env.timeseries.azure.com\",\"requestApiVersion\":\"2018-08-15-preview\",\"storageLimitExceededBehavior\":\"PurgeOldData\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql\",\"name\":\"rstr-cn1yql\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+standard+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "22", "23" ], + "x-ms-client-request-id": [ "efbd3321-c9c4-462f-9cf1-456a1daaa660", "efbd3321-c9c4-462f-9cf1-456a1daaa660" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-correlation-request-id": [ "17693cd8-6fea-4e94-82d5-c352b6e45100" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "d22aa811-2cb7-41ce-a8e7-d891d3d0dfd3" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11978" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073634Z:17693cd8-6fea-4e94-82d5-c352b6e45100" ], + "Date": [ "Wed, 08 Apr 2020 07:36:33 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "689" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:36:02 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba\",\"dataAccessFqdn\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql\",\"name\":\"rstr-cn1yql\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+standard+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "22", "23", "24" ], + "x-ms-client-request-id": [ "efbd3321-c9c4-462f-9cf1-456a1daaa660", "efbd3321-c9c4-462f-9cf1-456a1daaa660", "efbd3321-c9c4-462f-9cf1-456a1daaa660" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11977" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "a11a2fb2-93f0-4cdf-8da0-706fcf048ea3" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "613c1ad3-9342-4acf-a9c6-a2c0f15e7830" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073635Z:613c1ad3-9342-4acf-a9c6-a2c0f15e7830" ], + "Date": [ "Wed, 08 Apr 2020 07:36:34 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "689" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:36:02 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba\",\"dataAccessFqdn\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql\",\"name\":\"rstr-cn1yql\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+standard+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c?api-version=2018-08-15-preview+4": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c?api-version=2018-08-15-preview", + "Content": "{\n \"location\": \"eastus2\",\n \"sku\": {\n \"name\": \"S2\",\n \"capacity\": 2\n },\n \"kind\": \"Standard\",\n \"properties\": {\n \"dataRetentionTime\": \"P1DT1H25M\"\n }\n}", + "Headers": { + "x-ms-unique-id": [ "25" ], + "x-ms-client-request-id": [ "49d15474-cb7f-4657-95cd-2db0e39c545d" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "161" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1196" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "75ccbf1d-7d6c-4544-b2b1-c74660e73fe3" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "ada5ff2d-0c0d-4e77-8dee-6f5c97c59346" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073640Z:ada5ff2d-0c0d-4e77-8dee-6f5c97c59346" ], + "Date": [ "Wed, 08 Apr 2020 07:36:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "654" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S2\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"2020-04-08T07:36:39+00:00\",\"provisioningState\":\"Accepted\",\"dataAccessId\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3\",\"dataAccessFqdn\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3.env.timeseries.azure.com\",\"requestApiVersion\":\"2018-08-15-preview\",\"storageLimitExceededBehavior\":\"PurgeOldData\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c\",\"name\":\"rstr-jra51c\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+standard+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c?api-version=2018-08-15-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "25", "26" ], + "x-ms-client-request-id": [ "49d15474-cb7f-4657-95cd-2db0e39c545d", "49d15474-cb7f-4657-95cd-2db0e39c545d" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11976" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "8b365ab1-f0b0-4bc5-940e-5b76e8b1b476" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "456dbb44-e358-47a7-a9b4-e3d720d992fb" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073711Z:456dbb44-e358-47a7-a9b4-e3d720d992fb" ], + "Date": [ "Wed, 08 Apr 2020 07:37:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "689" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S2\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:36:39 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3\",\"dataAccessFqdn\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c\",\"name\":\"rstr-jra51c\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+standard+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c?api-version=2018-08-15-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "25", "26", "27" ], + "x-ms-client-request-id": [ "49d15474-cb7f-4657-95cd-2db0e39c545d", "49d15474-cb7f-4657-95cd-2db0e39c545d", "49d15474-cb7f-4657-95cd-2db0e39c545d" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11975" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "8c5f76ed-eb78-42ae-a826-4b58c67ce3d2" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "09b960eb-b9d3-4d40-bb06-2de96fcf52d8" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073711Z:09b960eb-b9d3-4d40-bb06-2de96fcf52d8" ], + "Date": [ "Wed, 08 Apr 2020 07:37:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "689" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S2\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:36:39 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3\",\"dataAccessFqdn\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c\",\"name\":\"rstr-jra51c\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+standard+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "28" ], + "x-ms-client-request-id": [ "d4881da8-0b0b-4d9f-985e-63e97733df8c" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11974" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "5ff731d8-1f28-4667-a794-5dcc79db5ab9" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "c73586e3-5d5a-499d-9d04-59c754f664fe" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073711Z:c73586e3-5d5a-499d-9d04-59c754f664fe" ], + "Date": [ "Wed, 08 Apr 2020 07:37:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "689" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:36:02 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba\",\"dataAccessFqdn\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql\",\"name\":\"rstr-cn1yql\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+standard+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c?api-version=2018-08-15-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "29" ], + "x-ms-client-request-id": [ "81c6d439-2bee-4f0b-995c-4d504bedfb40" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11973" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "351d9f05-3c98-4998-b8dd-8c183908e31d" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "329c9edb-f0f4-401c-83f7-a9f704ad0a95" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073712Z:329c9edb-f0f4-401c-83f7-a9f704ad0a95" ], + "Date": [ "Wed, 08 Apr 2020 07:37:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "689" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S2\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:36:39 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3\",\"dataAccessFqdn\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c\",\"name\":\"rstr-jra51c\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+longterm+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly?api-version=2018-08-15-preview", + "Content": "{\n \"location\": \"eastus2\",\n \"sku\": {\n \"name\": \"L1\",\n \"capacity\": 1\n },\n \"kind\": \"LongTerm\",\n \"properties\": {\n \"storageConfiguration\": {\n \"accountName\": \"staaccountmtudlr\",\n \"managementKey\": \"M8HfaiUFYeKeVNrsDAJGz9SzYDNSmXG9jNETt/oLcxRrW5Bsz2tVPSYePMVh7qn22yyRSNu3/pMgy0QYnKQ92Q==\"\n },\n \"timeSeriesIdProperties\": [\n {\n \"name\": \"cdc\",\n \"type\": \"string\"\n }\n ]\n }\n}", + "Headers": { + "x-ms-unique-id": [ "30" ], + "x-ms-client-request-id": [ "f0c42561-cdf4-487e-abf6-2f51c283adc3" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "418" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1195" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "e9b08d5e-df58-4926-a523-249a5dc9e8d7" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "a6a41489-2d34-4c94-9e20-66233bd86a3a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073715Z:a6a41489-2d34-4c94-9e20-66233bd86a3a" ], + "Date": [ "Wed, 08 Apr 2020 07:37:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "693" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountmtudlr\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"2020-04-08T07:37:14+00:00\",\"provisioningState\":\"Succeeded\",\"dataAccessId\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259\",\"dataAccessFqdn\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259.env.timeseries.azure.com\",\"requestApiVersion\":\"2018-08-15-preview\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly\",\"name\":\"rstr-s13wly\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+longterm+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "30", "31" ], + "x-ms-client-request-id": [ "f0c42561-cdf4-487e-abf6-2f51c283adc3", "f0c42561-cdf4-487e-abf6-2f51c283adc3" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-correlation-request-id": [ "2efe3664-d71b-4bc1-9c85-c925eba2bc0c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "c09ae789-ceef-417f-a781-96d11d69c64c" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11972" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073746Z:2efe3664-d71b-4bc1-9c85-c925eba2bc0c" ], + "Date": [ "Wed, 08 Apr 2020 07:37:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "697" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountmtudlr\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:37:14 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259\",\"dataAccessFqdn\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly\",\"name\":\"rstr-s13wly\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+longterm+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "30", "31", "32" ], + "x-ms-client-request-id": [ "f0c42561-cdf4-487e-abf6-2f51c283adc3", "f0c42561-cdf4-487e-abf6-2f51c283adc3", "f0c42561-cdf4-487e-abf6-2f51c283adc3" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11971" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "2698d2f6-0acb-403c-a998-5db369a5b78e" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "ff1ac4c9-0a40-4e52-955b-b85108a639f9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073747Z:ff1ac4c9-0a40-4e52-955b-b85108a639f9" ], + "Date": [ "Wed, 08 Apr 2020 07:37:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "697" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountmtudlr\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:37:14 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259\",\"dataAccessFqdn\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly\",\"name\":\"rstr-s13wly\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "New-AzTimeSeriesInsightsEnvironment+[NoContext]+longterm+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly?api-version=2018-08-15-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "33" ], + "x-ms-client-request-id": [ "c97c7ed1-da8f-47b3-b264-1d56b958edaa" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11970" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "1cb1e11a-333f-409c-bc2e-d658ca4054fb" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "f5aa64d3-d9e7-473a-a299-9c163eaf470f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073747Z:f5aa64d3-d9e7-473a-a299-9c163eaf470f" ], + "Date": [ "Wed, 08 Apr 2020 07:37:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "697" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountmtudlr\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:37:14 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259\",\"dataAccessFqdn\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly\",\"name\":\"rstr-s13wly\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEnvironment.Tests.ps1 b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEnvironment.Tests.ps1 new file mode 100644 index 000000000000..fa68c14e71eb --- /dev/null +++ b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEnvironment.Tests.ps1 @@ -0,0 +1,43 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzTimeSeriesInsightsEnvironment.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzTimeSeriesInsightsEnvironment' { + It 'standard' { + $kind = 'Standard' + $sku01 = 'S1' + $sku02 = 'S2' + $timeSpan = New-TimeSpan -Days 1 -Hours 1 -Minutes 25 + $capacity = 2 + + New-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $env.rstrenv02 -Kind $kind -Location $env.location -Sku $sku01 -DataRetentionTime $timeSpan -Capacity $capacity + New-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $env.rstrenv03 -Kind $kind -Location $env.location -Sku $sku02 -DataRetentionTime $timeSpan -Capacity $capacity + + $tsiEnv02 = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $env.rstrenv02 + $tsiEnv03 = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $env.rstrenv03 + $tsiEnv02.Name | Should -Be $env.rstrenv02 + $tsiEnv03.Name | Should -Be $env.rstrenv03 + } + + It 'longterm' { + $kind = 'LongTerm' + $sku = 'L1' + $capacity = 2 + $timeSeriesIdProperty = @{name='cdc';type='string'} + $staAccountName = $env.staaccountName01 + $staAccountKey = $env.staaccountName01_key | ConvertTo-SecureString -AsPlainText -Force + + New-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $env.rstrenv04 -Kind $kind -Location $env.location -Sku $sku -StorageAccountName $staAccountName -StorageAccountKey $staAccountKey -TimeSeriesIdProperty $timeSeriesIdProperty + $tsiEnv = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $env.rstrenv04 + $tsiEnv.Name | Should -Be $env.rstrenv04 + } +} diff --git a/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEventSource.Recording.json b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEventSource.Recording.json new file mode 100644 index 000000000000..3920c22f1613 --- /dev/null +++ b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEventSource.Recording.json @@ -0,0 +1,162 @@ +{ + "New-AzTimeSeriesInsightsEventSource+[NoContext]+eventhub+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/eventsources/rstr-ra0hqf?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/eventsources/rstr-ra0hqf?api-version=2018-08-15-preview", + "Content": "{\n \"location\": \"eastus2\",\n \"kind\": \"Microsoft.EventHub\",\n \"properties\": {\n \"eventSourceResourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-wcukl2/eventhubs/eventhubname-x7lcry\",\n \"consumerGroupName\": \"tsi-test-i01k5l\",\n \"eventHubName\": \"eventhubname-x7lcry\",\n \"keyName\": \"RootManageSharedAccessKey\",\n \"serviceBusNamespace\": \"eventhubspace-wcukl2\",\n \"sharedAccessKey\": \"YGX/J9qfyTCcC5AQr8h8xlIo4i8XZ6bySgglrDUyTuk=\"\n }\n}", + "Headers": { + "x-ms-unique-id": [ "34" ], + "x-ms-client-request-id": [ "da196d5a-a880-411d-a4d3-6517129b2f0e" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEventSource_Create" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "540" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1194" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "247d6297-a239-4373-bd3b-c9985acd46bd" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "f2ed41cf-88e1-484b-a719-7e787bb300eb" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073751Z:f2ed41cf-88e1-484b-a719-7e787bb300eb" ], + "Date": [ "Wed, 08 Apr 2020 07:37:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "778" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"kind\":\"Microsoft.EventHub\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-wcukl2/eventhubs/eventhubname-x7lcry\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"eventHubName\":\"eventhubname-x7lcry\",\"keyName\":\"RootManageSharedAccessKey\",\"serviceBusNamespace\":\"eventhubspace-wcukl2\",\"creationTime\":\"Wed, 08 Apr 2020 07:37:50 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/eventsources/rstr-ra0hqf\",\"name\":\"rstr-ra0hqf\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}" + } + }, + "New-AzTimeSeriesInsightsEventSource+[NoContext]+eventhub+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/eventsources/rstr-ra0hqf?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/eventsources/rstr-ra0hqf?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "35" ], + "x-ms-client-request-id": [ "217b2e09-a70b-4630-9250-8fed111655a7" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEventSource_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11969" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "41f39858-efa3-4d46-9eaa-e56bea220420" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "72cb0e53-adf7-48b8-9807-9e10c1e615b4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073752Z:72cb0e53-adf7-48b8-9807-9e10c1e615b4" ], + "Date": [ "Wed, 08 Apr 2020 07:37:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "778" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"kind\":\"Microsoft.EventHub\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-wcukl2/eventhubs/eventhubname-x7lcry\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"eventHubName\":\"eventhubname-x7lcry\",\"keyName\":\"RootManageSharedAccessKey\",\"serviceBusNamespace\":\"eventhubspace-wcukl2\",\"creationTime\":\"Wed, 08 Apr 2020 07:37:50 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/eventsources/rstr-ra0hqf\",\"name\":\"rstr-ra0hqf\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}" + } + }, + "New-AzTimeSeriesInsightsEventSource+[NoContext]+iothub+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/eventsources/rstr-l1j2ti?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/eventsources/rstr-l1j2ti?api-version=2018-08-15-preview", + "Content": "{\n \"location\": \"eastus2\",\n \"kind\": \"Microsoft.IoTHub\",\n \"properties\": {\n \"eventSourceResourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.Devices/IotHubs/iothubname-qnivtc\",\n \"consumerGroupName\": \"tsi-test-i01k5l\",\n \"iotHubName\": \"iothubname-qnivtc\",\n \"keyName\": \"RootManageSharedAccessKey\",\n \"sharedAccessKey\": \"2TnzezePKCeYjruy24uA4h3YGpyXEiF8jDb+fv/Hd64=\"\n }\n}", + "Headers": { + "x-ms-unique-id": [ "36" ], + "x-ms-client-request-id": [ "367bf785-b410-4e01-982d-5e059e32fb55" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEventSource_Create" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "446" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1193" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "ffa8b14b-9840-40dc-905a-71ef9e5f21f3" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "4247c81e-e569-439a-b2f1-65c71ea47a04" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073755Z:4247c81e-e569-439a-b2f1-65c71ea47a04" ], + "Date": [ "Wed, 08 Apr 2020 07:37:55 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "690" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"kind\":\"Microsoft.IoTHub\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.Devices/IotHubs/iothubname-qnivtc\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"iotHubName\":\"iothubname-qnivtc\",\"keyName\":\"RootManageSharedAccessKey\",\"creationTime\":\"Wed, 08 Apr 2020 07:37:54 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/eventsources/rstr-l1j2ti\",\"name\":\"rstr-l1j2ti\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}" + } + }, + "New-AzTimeSeriesInsightsEventSource+[NoContext]+iothub+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/eventsources/rstr-l1j2ti?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/eventsources/rstr-l1j2ti?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "37" ], + "x-ms-client-request-id": [ "59c6a1c9-0a48-4e7a-a28c-4c5b5fac1091" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEventSource_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11968" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "99b53274-aadb-4be5-a272-f0599de0702b" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "7e03a083-4af1-4c2d-8ba0-39a46a08ed0f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073756Z:7e03a083-4af1-4c2d-8ba0-39a46a08ed0f" ], + "Date": [ "Wed, 08 Apr 2020 07:37:55 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "690" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"kind\":\"Microsoft.IoTHub\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.Devices/IotHubs/iothubname-qnivtc\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"iotHubName\":\"iothubname-qnivtc\",\"keyName\":\"RootManageSharedAccessKey\",\"creationTime\":\"Wed, 08 Apr 2020 07:37:54 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/eventsources/rstr-l1j2ti\",\"name\":\"rstr-l1j2ti\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEventSource.Tests.ps1 b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEventSource.Tests.ps1 new file mode 100644 index 000000000000..c20a2c16c18d --- /dev/null +++ b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsEventSource.Tests.ps1 @@ -0,0 +1,41 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) + +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzTimeSeriesInsightsEventSource.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzTimeSeriesInsightsEventSource' { + It 'eventhub' { + $eventHubSpaceName = $env.eventHubSpaceName02 + $eventHubName = $env.eventHubName02 + $eventSourceResourceId = $env.eventHubName02_id + $eventSharedAccessKey = $env.eventHubName02_key | ConvertTo-SecureString -AsPlainText -Force + $environmentName = $env.rstrenv01 + $tsiEevntSourceName = $env.rstres01 + + New-AzTimeSeriesInsightsEventSource -ResourceGroupName $env.resourceGroup -Name $tsiEevntSourceName -EnvironmentName $environmentName -Kind Microsoft.EventHub -ConsumerGroupName $env.resourceGroup -Location $env.location -KeyName RootManageSharedAccessKey -ServiceBusNameSpace $eventHubSpaceName -EventHubName $eventHubName -EventSourceResourceId $eventSourceResourceId -SharedAccessKey $eventSharedAccessKey + $tsiEevntSource = Get-AzTimeSeriesInsightsEventSource -ResourceGroupName $env.resourceGroup -EnvironmentName $environmentName -Name $tsiEevntSourceName + $tsiEevntSource.Name | Should -Be $tsiEevntSourceName + } + + It 'iothub' { + $ioTHubName = $env.iotHubName + $iotSourceResourceId = $env.iotHubName_id + $iotSharedAccessKey = $env.iotHubName_key | ConvertTo-SecureString -AsPlainText -Force + $environmentName = $env.rstrenv02 + $tsiEevntSourceName = $env.rstres02 + + New-AzTimeSeriesInsightsEventSource -ResourceGroupName $env.resourceGroup -Name $tsiEevntSourceName -EnvironmentName $environmentName -Kind Microsoft.IoTHub -ConsumerGroupName $env.resourceGroup -Location $env.location -KeyName RootManageSharedAccessKey -IoTHubName $ioTHubName -EventSourceResourceId $iotSourceResourceId -SharedAccessKey $iotSharedAccessKey + $tsiEevntSource = Get-AzTimeSeriesInsightsEventSource -ResourceGroupName $env.resourceGroup -EnvironmentName $environmentName -Name $tsiEevntSourceName + $tsiEevntSource.Name | Should -Be $tsiEevntSourceName + } +} diff --git a/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsReferenceDataSet.Recording.json b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsReferenceDataSet.Recording.json new file mode 100644 index 000000000000..c9bb6068e99b --- /dev/null +++ b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsReferenceDataSet.Recording.json @@ -0,0 +1,43 @@ +{ + "New-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/referenceDataSets/tsirds001?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/referenceDataSets/tsirds001?api-version=2018-08-15-preview", + "Content": "{\n \"location\": \"eastus2\",\n \"properties\": {\n \"dataStringComparisonBehavior\": \"Ordinal\",\n \"keyProperties\": [\n {\n \"name\": \"device01\",\n \"type\": \"Double\"\n }\n ]\n }\n}", + "Headers": { + "x-ms-unique-id": [ "38" ], + "x-ms-client-request-id": [ "f7cbf517-f97f-4483-baea-27d7d91aa6c7" ], + "CommandName": [ "New-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsReferenceDataSet_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "195" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1192" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "65020b26-956f-482e-b638-cfd2d4b55e6f" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "c0edec2f-0955-4638-aeee-9209ac34cefd" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073759Z:c0edec2f-0955-4638-aeee-9209ac34cefd" ], + "Date": [ "Wed, 08 Apr 2020 07:37:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "493" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:37:58 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/referenceDataSets/tsirds001\",\"name\":\"tsirds001\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 new file mode 100644 index 000000000000..88a43db929d6 --- /dev/null +++ b/src/TimeSeriesInsights/test/New-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 @@ -0,0 +1,23 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) + +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzTimeSeriesInsightsReferenceDataSet.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzTimeSeriesInsightsReferenceDataSet' { + It 'CreateExpanded' { + $tsiDsName = 'tsirds001' + $mykeyproperties = @{ "name" = "device01"; "type" = "Double"} + $environmentName = $env.rstrenv02 + $tsiDs = New-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $environmentName -Name $tsiDsName -ResourceGroupName $env.resourceGroup -Location $env.location -DataStringComparisonBehavior Ordinal -KeyProperty $mykeyproperties + $tsiDs.Name | Should -Be $tsiDsName + } +} diff --git a/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsAccessPolicy.Recording.json b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsAccessPolicy.Recording.json new file mode 100644 index 000000000000..5195498c3e21 --- /dev/null +++ b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsAccessPolicy.Recording.json @@ -0,0 +1,197 @@ +{ + "Remove-AzTimeSeriesInsightsAccessPolicy+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/accesspolicies/rstr-hszj9q?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/accesspolicies/rstr-hszj9q?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "39" ], + "x-ms-client-request-id": [ "50ef9998-5c9e-471f-a684-a0a49027e17b" ], + "CommandName": [ "Remove-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Remove-AzTimeSeriesInsightsAccessPolicy_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "179edf31-a45f-46c8-8ed3-705a3a2cdacf" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "a21d2c98-6417-4629-b24e-adec1ee3a915" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073800Z:a21d2c98-6417-4629-b24e-adec1ee3a915" ], + "Date": [ "Wed, 08 Apr 2020 07:37:59 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzTimeSeriesInsightsAccessPolicy+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/accessPolicies?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1/accessPolicies?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "40" ], + "x-ms-client-request-id": [ "e8613aae-d9b8-445a-af3d-e99b9a42bb38" ], + "CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11967" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "e392b06d-1fad-4951-b023-14a0adf9f406" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "6bc9bd7f-3dcb-4297-b1af-d1e3555ff2c2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073800Z:6bc9bd7f-3dcb-4297-b1af-d1e3555ff2c2" ], + "Date": [ "Wed, 08 Apr 2020 07:38:00 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "12" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[]}" + } + }, + "Remove-AzTimeSeriesInsightsAccessPolicy+[NoContext]+DeleteViaIdentity+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/accesspolicies/rstr-xnycis?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/accesspolicies/rstr-xnycis?api-version=2018-08-15-preview", + "Content": "{\n \"properties\": {\n \"principalObjectId\": \"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\n \"roles\": [ \"Reader\" ]\n }\n}", + "Headers": { + "x-ms-unique-id": [ "41" ], + "x-ms-client-request-id": [ "f9c74d96-6883-4d1b-949d-b93044508f12" ], + "CommandName": [ "New-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsAccessPolicy_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "116" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1191" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "a9418bb9-14ad-4be6-8272-f9960ae0015b" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "61ceb1c7-4046-4f08-9bdc-c079e075e283" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073801Z:61ceb1c7-4046-4f08-9bdc-c079e075e283" ], + "Date": [ "Wed, 08 Apr 2020 07:38:00 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "362" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/accesspolicies/rstr-xnycis\",\"name\":\"rstr-xnycis\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}" + } + }, + "Remove-AzTimeSeriesInsightsAccessPolicy+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/accesspolicies/rstr-xnycis?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/accesspolicies/rstr-xnycis?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "42" ], + "x-ms-client-request-id": [ "b2868a53-a3be-4215-9ee2-90b42b126947" ], + "CommandName": [ "Remove-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Remove-AzTimeSeriesInsightsAccessPolicy_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14998" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "f323c84f-272d-47d0-b463-0f1c7100e3b7" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "3fab9d5b-43f3-469a-90b0-3e44bde875f5" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073801Z:3fab9d5b-43f3-469a-90b0-3e44bde875f5" ], + "Date": [ "Wed, 08 Apr 2020 07:38:01 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzTimeSeriesInsightsAccessPolicy+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/accessPolicies?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql/accessPolicies?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "43" ], + "x-ms-client-request-id": [ "8651b761-b9cc-4803-84c2-0ba4c73002e9" ], + "CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11966" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "8492b8d3-f92e-439c-b3cb-263b94240d28" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "b28e3f57-936f-48c1-bcc4-c934568fb3f2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073802Z:b28e3f57-936f-48c1-bcc4-c934568fb3f2" ], + "Date": [ "Wed, 08 Apr 2020 07:38:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "12" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[]}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 new file mode 100644 index 000000000000..cf11a6b1c26d --- /dev/null +++ b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 @@ -0,0 +1,33 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzTimeSeriesInsightsAccessPolicy.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzTimeSeriesInsightsAccessPolicy' { + It 'Delete' { + $environmentName = $env.rstrenv01 + $accessPolicyName = $env.rstrap01 + Remove-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $environmentName -Name $accessPolicyName -ResourceGroupName $env.resourceGroup + $policyList = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $environmentName -ResourceGroupName $env.resourceGroup + $policyList.Name | Should -Not -Contain $accessPolicyName + } + + It 'DeleteViaIdentity' { + $environmentName = $env.rstrenv02 + $accessPolicyName = $env.rstrap02 + $role = 'Reader' + $policy = New-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $environmentName -ResourceGroupName $env.resourceGroup -PrincipalObjectId $env.principalObjectId -Role $role -Name $accessPolicyName + Remove-AzTimeSeriesInsightsAccessPolicy -InputObject $policy + $policyList = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $environmentName -ResourceGroupName $env.resourceGroup + $policyList.Name | Should -Not -Contain $accessPolicyName + + } +} diff --git a/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEnvironment.Recording.json b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEnvironment.Recording.json new file mode 100644 index 000000000000..2edf3c38d014 --- /dev/null +++ b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEnvironment.Recording.json @@ -0,0 +1,195 @@ +{ + "Remove-AzTimeSeriesInsightsEnvironment+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-8uxmh1?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "44" ], + "x-ms-client-request-id": [ "fb9a2da3-9ad7-46d2-8345-07328543a568" ], + "CommandName": [ "Remove-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Remove-AzTimeSeriesInsightsEnvironment_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14997" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "1628b0db-6d3c-4045-a2ec-5ede278b65f3" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "bbf53bdb-c5c5-45c0-8901-dce9ad69e30b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073805Z:bbf53bdb-c5c5-45c0-8901-dce9ad69e30b" ], + "Date": [ "Wed, 08 Apr 2020 07:38:05 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzTimeSeriesInsightsEnvironment+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "45" ], + "x-ms-client-request-id": [ "91c784ce-f0fd-4a30-a48c-5112169d4d5d" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11965" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "28ba0cc0-eec1-4824-8602-b58914ebc707" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "fdc0052c-a4b5-4578-9e42-652fa43c21ba" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073805Z:fdc0052c-a4b5-4578-9e42-652fa43c21ba" ], + "Date": [ "Wed, 08 Apr 2020 07:38:05 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "3485" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:30:17 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9\",\"dataAccessFqdn\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x\",\"name\":\"tsi-envv8u56x\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"},{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountxvtbjq\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:30:54 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3\",\"dataAccessFqdn\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk\",\"name\":\"tsi-envui70dk\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"},{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountmtudlr\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:37:14 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259\",\"dataAccessFqdn\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly\",\"name\":\"rstr-s13wly\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"},{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:36:02 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba\",\"dataAccessFqdn\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql\",\"name\":\"rstr-cn1yql\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"},{\"sku\":{\"name\":\"S2\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:36:39 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3\",\"dataAccessFqdn\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c\",\"name\":\"rstr-jra51c\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}]}" + } + }, + "Remove-AzTimeSeriesInsightsEnvironment+[NoContext]+DeleteInputObject+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "46" ], + "x-ms-client-request-id": [ "20b88f4a-52fb-4747-b55b-ae1c51671307" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11964" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "37a86bf1-cffe-48fe-8018-8b291412d0af" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "7617ef11-be2c-4999-8dd1-c1b3497d1d8d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073806Z:7617ef11-be2c-4999-8dd1-c1b3497d1d8d" ], + "Date": [ "Wed, 08 Apr 2020 07:38:05 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "689" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:36:02 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba\",\"dataAccessFqdn\":\"a36df2a5-78d9-41c1-8a42-482c15f840ba.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql\",\"name\":\"rstr-cn1yql\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Remove-AzTimeSeriesInsightsEnvironment+[NoContext]+DeleteInputObject+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-cn1yql?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "47" ], + "x-ms-client-request-id": [ "d217a355-a096-44a8-92ed-5c1c97730086" ], + "CommandName": [ "Remove-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Remove-AzTimeSeriesInsightsEnvironment_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14996" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "a36d258f-6fe1-4305-9d5a-c1f81b49cf87" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "3f9d83c7-3174-48da-9c0b-be6af6cfd3ec" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073808Z:3f9d83c7-3174-48da-9c0b-be6af6cfd3ec" ], + "Date": [ "Wed, 08 Apr 2020 07:38:08 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzTimeSeriesInsightsEnvironment+[NoContext]+DeleteInputObject+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "48" ], + "x-ms-client-request-id": [ "ee7f1700-2cb4-4541-8967-13a9e3f6acf9" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11963" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "0a978e1f-8fae-4dc6-b285-c9581894887a" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "8c5d716c-5e7b-4356-99de-137659837e0d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073808Z:8c5d716c-5e7b-4356-99de-137659837e0d" ], + "Date": [ "Wed, 08 Apr 2020 07:38:08 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2795" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:30:17 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9\",\"dataAccessFqdn\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x\",\"name\":\"tsi-envv8u56x\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"},{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountxvtbjq\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:30:54 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3\",\"dataAccessFqdn\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk\",\"name\":\"tsi-envui70dk\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"},{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountmtudlr\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:37:14 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259\",\"dataAccessFqdn\":\"1ae694bd-9eb2-4005-931e-867f2f8e2259.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-s13wly\",\"name\":\"rstr-s13wly\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"},{\"sku\":{\"name\":\"S2\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:36:39 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3\",\"dataAccessFqdn\":\"2043650c-7f95-492f-a570-7bd7bb1f88f3.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c\",\"name\":\"rstr-jra51c\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}]}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEnvironment.Tests.ps1 b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEnvironment.Tests.ps1 new file mode 100644 index 000000000000..c79cd80c2b20 --- /dev/null +++ b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEnvironment.Tests.ps1 @@ -0,0 +1,29 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) + +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzTimeSeriesInsightsEnvironment.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzTimeSeriesInsightsEnvironment' { + It 'Delete' { + $environmentName = $env.rstrenv01 + Remove-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $environmentName + $tisEnvList = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup + $tisEnvList.Name | Should -Not -Contain $environmentName + } + It 'DeleteInputObject' { + $environmentName = $env.rstrenv02 + $tsiEnv = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $environmentName + Remove-AzTimeSeriesInsightsEnvironment -InputObject $tsiEnv + $tisEnvList = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup + $tisEnvList.Name | Should -Not -Contain $environmentName + } +} diff --git a/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEventSource.Recording.json b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEventSource.Recording.json new file mode 100644 index 000000000000..17042f424953 --- /dev/null +++ b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEventSource.Recording.json @@ -0,0 +1,193 @@ +{ + "Remove-AzTimeSeriesInsightsEventSource+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c/eventsources/rstr-mklg1c?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c/eventsources/rstr-mklg1c?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "49" ], + "x-ms-client-request-id": [ "c13da34d-f78a-4977-95e9-3d4095e720e9" ], + "CommandName": [ "Remove-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Remove-AzTimeSeriesInsightsEventSource_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14995" ], + "x-ms-request-id": [ "b9699580-71d2-4685-9390-0e9f4abc6043" ], + "x-ms-correlation-request-id": [ "b9699580-71d2-4685-9390-0e9f4abc6043" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073809Z:b9699580-71d2-4685-9390-0e9f4abc6043" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 08 Apr 2020 07:38:09 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzTimeSeriesInsightsEventSource+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c/eventSources?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-jra51c/eventSources?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "50" ], + "x-ms-client-request-id": [ "67f9b115-f7b1-4afd-9fb5-9b91feb94c27" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEventSource_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11962" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "aefb42aa-fe5c-4ac2-bdb3-8c1269fb2d67" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "a15d92a0-97bb-45bb-97fe-6ceef1f0ef27" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073810Z:a15d92a0-97bb-45bb-97fe-6ceef1f0ef27" ], + "Date": [ "Wed, 08 Apr 2020 07:38:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "12" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[]}" + } + }, + "Remove-AzTimeSeriesInsightsEventSource+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk/eventsources/tsi-esjar3w6?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk/eventsources/tsi-esjar3w6?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "51" ], + "x-ms-client-request-id": [ "04608494-dac1-4cda-9a3b-f270c99301db" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEventSource_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11961" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "9142780b-45e8-4f5a-b1ee-47728d5a325c" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "ec278338-bc84-493b-9d8b-b7d6b5f4a017" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073810Z:ec278338-bc84-493b-9d8b-b7d6b5f4a017" ], + "Date": [ "Wed, 08 Apr 2020 07:38:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "782" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"kind\":\"Microsoft.EventHub\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-p6qzi9/eventhubs/eventhubname-vwrm83\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"eventHubName\":\"eventhubname-vwrm83\",\"keyName\":\"RootManageSharedAccessKey\",\"serviceBusNamespace\":\"eventhubspace-p6qzi9\",\"creationTime\":\"Wed, 08 Apr 2020 07:31:34 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk/eventsources/tsi-esjar3w6\",\"name\":\"tsi-esjar3w6\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}" + } + }, + "Remove-AzTimeSeriesInsightsEventSource+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk/eventsources/tsi-esjar3w6?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk/eventsources/tsi-esjar3w6?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "52" ], + "x-ms-client-request-id": [ "7c4df51a-6bba-4eff-b125-d036bf925865" ], + "CommandName": [ "Remove-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Remove-AzTimeSeriesInsightsEventSource_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14994" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "2090e3cc-0393-4580-9685-710968c4de1f" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "9660af9d-d52b-4cc1-894f-721041a44bf6" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073812Z:9660af9d-d52b-4cc1-894f-721041a44bf6" ], + "Date": [ "Wed, 08 Apr 2020 07:38:12 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzTimeSeriesInsightsEventSource+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk/eventSources?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk/eventSources?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "53" ], + "x-ms-client-request-id": [ "8a614262-17b0-446f-992e-7997e566c7a0" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEventSource_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11960" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "caa40840-a918-4412-ab08-ee2f0f6816f8" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "39de6b05-7a93-4dc4-ba12-64a495249b3e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073813Z:39de6b05-7a93-4dc4-ba12-64a495249b3e" ], + "Date": [ "Wed, 08 Apr 2020 07:38:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "12" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[]}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEventSource.Tests.ps1 b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEventSource.Tests.ps1 new file mode 100644 index 000000000000..5e18dfaeb8c0 --- /dev/null +++ b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsEventSource.Tests.ps1 @@ -0,0 +1,31 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzTimeSeriesInsightsEventSource.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzTimeSeriesInsightsEventSource' { + It 'Delete' { + $environmentName = $env.rstrenv03 + $tsiEevntSourceName = $env.rstres03 + Remove-AzTimeSeriesInsightsEventSource -EnvironmentName $environmentName -Name $tsiEevntSourceName -ResourceGroupName $env.ResourceGroup + $tsiEventSorceList = Get-AzTimeSeriesInsightsEventSource -EnvironmentName $environmentName -ResourceGroupName $env.ResourceGroup + $tsiEventSorceList.Name | Should -Not -Contain $tsiEevntSourceName + } + + It 'DeleteViaIdentity' { + $environmentName = $env.tsiEnvName01 + $tsiEevntSourceName = $env.tsiEsName01 + $getTsiEventSorce = Get-AzTimeSeriesInsightsEventSource -EnvironmentName $environmentName -ResourceGroupName $env.resourceGroup -Name $tsiEevntSourceName + Remove-AzTimeSeriesInsightsEventSource -InputObject $getTsiEventSorce + $tsiEventSorceList = Get-AzTimeSeriesInsightsEventSource -EnvironmentName $environmentName -ResourceGroupName $env.ResourceGroup + $tsiEventSorceList.Name | Should -Not -Contain $getTsiEventSorce.Name + } +} diff --git a/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsReferenceDataSet.Recording.json b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsReferenceDataSet.Recording.json new file mode 100644 index 000000000000..faf7a0c1fbb4 --- /dev/null +++ b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsReferenceDataSet.Recording.json @@ -0,0 +1,357 @@ +{ + "Remove-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+Delete+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p?api-version=2018-08-15-preview", + "Content": "{\n \"location\": \"eastus2\",\n \"sku\": {\n \"name\": \"S1\",\n \"capacity\": 2\n },\n \"kind\": \"Standard\",\n \"properties\": {\n \"dataRetentionTime\": \"P1DT1H25M\"\n }\n}", + "Headers": { + "x-ms-unique-id": [ "54" ], + "x-ms-client-request-id": [ "2e455af0-f40b-4043-a773-0a4c64a125a0" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "161" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1190" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "02c0255e-898f-4f64-83df-7830c8828fda" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "c2e33e86-2843-4d9c-83d0-adf5604ca19d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073816Z:c2e33e86-2843-4d9c-83d0-adf5604ca19d" ], + "Date": [ "Wed, 08 Apr 2020 07:38:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "654" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"2020-04-08T07:38:15+00:00\",\"provisioningState\":\"Accepted\",\"dataAccessId\":\"2506153c-c73c-4cae-a3fc-0d8ad35122c4\",\"dataAccessFqdn\":\"2506153c-c73c-4cae-a3fc-0d8ad35122c4.env.timeseries.azure.com\",\"requestApiVersion\":\"2018-08-15-preview\",\"storageLimitExceededBehavior\":\"PurgeOldData\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p\",\"name\":\"rstr-d2ih3p\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Remove-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "54", "55" ], + "x-ms-client-request-id": [ "2e455af0-f40b-4043-a773-0a4c64a125a0", "2e455af0-f40b-4043-a773-0a4c64a125a0" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11959" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "8edfc5e7-276c-4bf4-8a3c-b5b41f0dfa28" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "1e74473a-187c-4f52-8cd2-88aef5148b27" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073847Z:1e74473a-187c-4f52-8cd2-88aef5148b27" ], + "Date": [ "Wed, 08 Apr 2020 07:38:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "689" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:38:15 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"2506153c-c73c-4cae-a3fc-0d8ad35122c4\",\"dataAccessFqdn\":\"2506153c-c73c-4cae-a3fc-0d8ad35122c4.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p\",\"name\":\"rstr-d2ih3p\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Remove-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "54", "55", "56" ], + "x-ms-client-request-id": [ "2e455af0-f40b-4043-a773-0a4c64a125a0", "2e455af0-f40b-4043-a773-0a4c64a125a0", "2e455af0-f40b-4043-a773-0a4c64a125a0" ], + "CommandName": [ "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment", "Az.TimeSeriesInsights.internal\\New-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create", "New-AzTimeSeriesInsightsEnvironment_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview", "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11958" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "58527ea3-5a63-4630-bfb3-c49daad773ab" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "62cf93f6-dca8-445c-8fb8-bfd4d67010f1" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073847Z:62cf93f6-dca8-445c-8fb8-bfd4d67010f1" ], + "Date": [ "Wed, 08 Apr 2020 07:38:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "689" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:38:15 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"2506153c-c73c-4cae-a3fc-0d8ad35122c4\",\"dataAccessFqdn\":\"2506153c-c73c-4cae-a3fc-0d8ad35122c4.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p\",\"name\":\"rstr-d2ih3p\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Remove-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+Delete+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets/removeds003?api-version=2018-08-15-preview+4": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets/removeds003?api-version=2018-08-15-preview", + "Content": "{\n \"location\": \"eastus2\",\n \"properties\": {\n \"dataStringComparisonBehavior\": \"Ordinal\",\n \"keyProperties\": [\n {\n \"name\": \"device01\",\n \"type\": \"Double\"\n }\n ]\n }\n}", + "Headers": { + "x-ms-unique-id": [ "57" ], + "x-ms-client-request-id": [ "9dc3d0ea-7ca0-4f8b-a0bc-c99b8a99a972" ], + "CommandName": [ "New-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsReferenceDataSet_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "195" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1189" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "48d84884-0ef4-4e9a-9f3f-aa88607b4030" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "490eccfc-56c0-4490-9622-53b4a7c9d4a0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073851Z:490eccfc-56c0-4490-9622-53b4a7c9d4a0" ], + "Date": [ "Wed, 08 Apr 2020 07:38:50 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "497" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:38:50 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets/removeds003\",\"name\":\"removeds003\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}" + } + }, + "Remove-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets/removeds003?api-version=2018-08-15-preview+5": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets/removeds003?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "58" ], + "x-ms-client-request-id": [ "fcd572f0-3449-41e7-bbf5-718ebec18b56" ], + "CommandName": [ "Remove-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Remove-AzTimeSeriesInsightsReferenceDataSet_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14993" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "f1e60c4a-3f1f-4441-8348-203d2258adb7" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "72990092-f809-412a-8331-388a1c267796" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073854Z:72990092-f809-412a-8331-388a1c267796" ], + "Date": [ "Wed, 08 Apr 2020 07:38:53 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets?api-version=2018-08-15-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "59" ], + "x-ms-client-request-id": [ "d62a608f-c2e8-4459-a2d1-9633a38c01af" ], + "CommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11957" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "696da676-9df5-4531-b8cf-28cddce9b682" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "d0f96555-7384-4aec-8eb5-f167b713228f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073854Z:d0f96555-7384-4aec-8eb5-f167b713228f" ], + "Date": [ "Wed, 08 Apr 2020 07:38:53 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "12" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[]}" + } + }, + "Remove-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+DeleteViaIdentity+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets/removeds002?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets/removeds002?api-version=2018-08-15-preview", + "Content": "{\n \"location\": \"eastus2\",\n \"properties\": {\n \"dataStringComparisonBehavior\": \"Ordinal\",\n \"keyProperties\": [\n {\n \"name\": \"device01\",\n \"type\": \"Double\"\n }\n ]\n }\n}", + "Headers": { + "x-ms-unique-id": [ "60" ], + "x-ms-client-request-id": [ "b16a0095-11aa-43a7-b9e6-922aa6470ab1" ], + "CommandName": [ "New-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "New-AzTimeSeriesInsightsReferenceDataSet_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "195" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1188" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "28b8f2a9-1a20-4b5e-aa38-92efaa3b942b" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "0e0206b9-c25f-42ad-a432-a8d907dd26a3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073857Z:0e0206b9-c25f-42ad-a432-a8d907dd26a3" ], + "Date": [ "Wed, 08 Apr 2020 07:38:56 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "497" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:38:56 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets/removeds002\",\"name\":\"removeds002\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}" + } + }, + "Remove-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets/removeds002?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets/removeds002?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "61" ], + "x-ms-client-request-id": [ "465e8a9d-648d-4d8b-8eb0-8a506040274a" ], + "CommandName": [ "Remove-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Remove-AzTimeSeriesInsightsReferenceDataSet_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-correlation-request-id": [ "92215d1a-ce5a-4d54-afa8-de07abb1544a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "1609372c-6926-4315-a9d6-7ace71933f52" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14992" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073900Z:92215d1a-ce5a-4d54-afa8-de07abb1544a" ], + "Date": [ "Wed, 08 Apr 2020 07:38:59 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/rstr-d2ih3p/referenceDataSets?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "62" ], + "x-ms-client-request-id": [ "6cefad32-1615-4a6d-a919-7000a4a6f540" ], + "CommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11956" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "0d87f512-cc24-48ed-9e0d-dd0a24bf180c" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "019030c4-3784-48d9-bfc9-302471681839" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073901Z:019030c4-3784-48d9-bfc9-302471681839" ], + "Date": [ "Wed, 08 Apr 2020 07:39:00 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "12" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[]}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 new file mode 100644 index 000000000000..465df1a87055 --- /dev/null +++ b/src/TimeSeriesInsights/test/Remove-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 @@ -0,0 +1,40 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzTimeSeriesInsightsReferenceDataSet.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzTimeSeriesInsightsReferenceDataSet' { + It 'Delete' { + $kind = 'Standard' + $sku01 = 'S1' + $timeSpan = New-TimeSpan -Days 1 -Hours 1 -Minutes 25 + $capacity = 2 + $environmentName = $env.rstrenv05 + $tsiDsName = 'removeds003' + $mykeyproperties = @{ "name" = "device01"; "type" = "Double"} + New-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $environmentName -Kind $kind -Location $env.location -Sku $sku01 -DataRetentionTime $timeSpan -Capacity $capacity + New-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $environmentName -Name $tsiDsName -ResourceGroupName $env.resourceGroup -Location $env.location -DataStringComparisonBehavior Ordinal -KeyProperty $mykeyproperties + + Remove-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $environmentName -Name $tsiDsName -ResourceGroupName $env.resourceGroup + $tsiDsList = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $environmentName -ResourceGroupName $env.resourceGroup + $tsiDsList.Name | Should -not -contain $tsiDsName + + } + It 'DeleteViaIdentity' { + $environmentName = $env.rstrenv05 + $tsiDsName = 'removeds002' + $mykeyproperties = @{ "name" = "device01"; "type" = "Double"} + $tsiDs = New-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $environmentName -Name $tsiDsName -ResourceGroupName $env.resourceGroup -Location $env.location -DataStringComparisonBehavior Ordinal -KeyProperty $mykeyproperties + Remove-AzTimeSeriesInsightsReferenceDataSet -InputObject $tsiDs + $tsiDsList = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $environmentName -ResourceGroupName $env.resourceGroup + $tsiDsList.Name | Should -not -contain $tsiDsName + } +} diff --git a/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsAccessPolicy.Recording.json b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsAccessPolicy.Recording.json new file mode 100644 index 000000000000..8ab85beed751 --- /dev/null +++ b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsAccessPolicy.Recording.json @@ -0,0 +1,201 @@ +{ + "Update-AzTimeSeriesInsightsAccessPolicy+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview", + "Content": "{\n \"properties\": {\n \"roles\": [ \"Contributor\" ]\n }\n}", + "Headers": { + "x-ms-unique-id": [ "63" ], + "x-ms-client-request-id": [ "a84cd930-f4dd-417d-9c67-e1b961adc76f" ], + "CommandName": [ "Update-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Update-AzTimeSeriesInsightsAccessPolicy_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "56" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1187" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "e5472a95-a623-4cdb-9ee2-1419a9a99c6d" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "5a5d262f-d34b-40f8-909b-526e72389f93" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073902Z:5a5d262f-d34b-40f8-909b-526e72389f93" ], + "Date": [ "Wed, 08 Apr 2020 07:39:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "371" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Contributor\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y\",\"name\":\"tsi-apilgj5y\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}" + } + }, + "Update-AzTimeSeriesInsightsAccessPolicy+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accessPolicies?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accessPolicies?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "64" ], + "x-ms-client-request-id": [ "bf56f731-ba33-4b8d-b728-337fc1ffc16b" ], + "CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11955" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "f179438f-2a8a-46ca-91e0-d0dbbf0ff0a7" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "afd0d3b4-3283-4b51-a03b-d04e741c17b0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073902Z:afd0d3b4-3283-4b51-a03b-d04e741c17b0" ], + "Date": [ "Wed, 08 Apr 2020 07:39:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "383" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Contributor\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y\",\"name\":\"tsi-apilgj5y\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}]}" + } + }, + "Update-AzTimeSeriesInsightsAccessPolicy+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "65" ], + "x-ms-client-request-id": [ "42898952-68e5-42e9-b6fa-309d7c1c3a5e" ], + "CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11954" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "3d121e14-2eff-4b28-83f2-893097f009cb" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "8edd06da-4ce0-44bd-bc55-4f8d81d69553" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073902Z:8edd06da-4ce0-44bd-bc55-4f8d81d69553" ], + "Date": [ "Wed, 08 Apr 2020 07:39:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "371" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Contributor\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y\",\"name\":\"tsi-apilgj5y\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}" + } + }, + "Update-AzTimeSeriesInsightsAccessPolicy+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y?api-version=2018-08-15-preview", + "Content": "{\n \"properties\": {\n \"roles\": [ \"Reader\" ]\n }\n}", + "Headers": { + "x-ms-unique-id": [ "66" ], + "x-ms-client-request-id": [ "07bb0f0a-ba1b-4692-8a3d-f4d5834b23a6" ], + "CommandName": [ "Update-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Update-AzTimeSeriesInsightsAccessPolicy_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "51" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1186" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "60f943bc-ab95-4c9d-994b-888d12683ef5" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "0a10e43e-428d-40eb-8f16-5db4e8c753a1" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073903Z:0a10e43e-428d-40eb-8f16-5db4e8c753a1" ], + "Date": [ "Wed, 08 Apr 2020 07:39:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "366" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y\",\"name\":\"tsi-apilgj5y\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}" + } + }, + "Update-AzTimeSeriesInsightsAccessPolicy+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accessPolicies?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accessPolicies?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "67" ], + "x-ms-client-request-id": [ "cbb8ce59-96c8-452b-bcaa-22b1771214a2" ], + "CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11953" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "e6503286-5464-45c0-bbd6-051b6c6b8cc1" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "0171e83a-47ed-43f2-8bf3-1b80362b7b23" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073903Z:0171e83a-47ed-43f2-8bf3-1b80362b7b23" ], + "Date": [ "Wed, 08 Apr 2020 07:39:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "378" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/accesspolicies/tsi-apilgj5y\",\"name\":\"tsi-apilgj5y\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}]}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 new file mode 100644 index 000000000000..901d4245d2c1 --- /dev/null +++ b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsAccessPolicy.Tests.ps1 @@ -0,0 +1,34 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) + +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzTimeSeriesInsightsAccessPolicy.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzTimeSeriesInsightsAccessPolicy' { + It 'UpdateExpanded' { + $newRole = 'Contributor' + $environmentName = $env.tsiEnvName + $accessPolicy = $env.accessPolicy + Update-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $environmentName -Name $accessPolicy -ResourceGroupName $env.ResourceGroup -Role $newRole + $policy = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $environmentName -ResourceGroupName $env.ResourceGroup + $policy.Role | Should -Be $newRole + } + + It 'UpdateViaIdentityExpanded' { + $newRole = 'Reader' + $environmentName = $env.tsiEnvName + $accessPolicy = $env.accessPolicy + $policy = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup -Name $env.accessPolicy + Update-AzTimeSeriesInsightsAccessPolicy -InputObject $policy -Role $newRole + $policy = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $environmentName -ResourceGroupName $env.ResourceGroup + $policy.Role | Should -Be $newRole + } +} diff --git a/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEnvironment.Recording.json b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEnvironment.Recording.json new file mode 100644 index 000000000000..491dfcbe6fb3 --- /dev/null +++ b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEnvironment.Recording.json @@ -0,0 +1,478 @@ +{ + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateStandard+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "68" ], + "x-ms-client-request-id": [ "9d94d60b-5d28-4c62-922c-392726cd4309" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11952" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "0542c858-c492-49d9-9926-21d3d77a4ca2" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "8839181f-a613-468c-82c1-c76ca286c542" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073904Z:8839181f-a613-468c-82c1-c76ca286c542" ], + "Date": [ "Wed, 08 Apr 2020 07:39:04 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "693" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":null,\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:30:17 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9\",\"dataAccessFqdn\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x\",\"name\":\"tsi-envv8u56x\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateStandard+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview", + "Content": "{\n \"sku\": {\n \"name\": \"S1\",\n \"capacity\": 2\n }\n}", + "Headers": { + "x-ms-unique-id": [ "69" ], + "x-ms-client-request-id": [ "e50a1426-3e20-4481-986e-38753f398d35" ], + "CommandName": [ "Update-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Update-AzTimeSeriesInsightsEnvironment_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "54" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1185" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "06d11567-1fc7-498c-b4ea-c2c950f5044b" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "24d603d9-0623-4788-9d4c-70dc112cba15" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073906Z:24d603d9-0623-4788-9d4c-70dc112cba15" ], + "Date": [ "Wed, 08 Apr 2020 07:39:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "691" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":{},\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:30:17 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9\",\"dataAccessFqdn\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x\",\"name\":\"tsi-envv8u56x\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateStandard+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "70" ], + "x-ms-client-request-id": [ "57d34c26-487c-454f-90b3-48696b73a259" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11951" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "e0fd8e01-3ba7-4725-b711-c8633a15d8e1" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "ce118cba-75a7-4c8d-98e1-2a02df742803" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073907Z:ce118cba-75a7-4c8d-98e1-2a02df742803" ], + "Date": [ "Wed, 08 Apr 2020 07:39:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "691" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":{},\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:30:17 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9\",\"dataAccessFqdn\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x\",\"name\":\"tsi-envv8u56x\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateStandardInputObject+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "71" ], + "x-ms-client-request-id": [ "b1cce224-cbb6-4d9d-9449-1c9b7079ab77" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11950" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "24213696-c73a-4879-9a60-a6caba2ade36" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "97d2fcdc-9372-4199-b93b-c205ef04d2a9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073907Z:97d2fcdc-9372-4199-b93b-c205ef04d2a9" ], + "Date": [ "Wed, 08 Apr 2020 07:39:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "691" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":2},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":{},\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:30:17 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9\",\"dataAccessFqdn\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x\",\"name\":\"tsi-envv8u56x\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateStandardInputObject+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview", + "Content": "{\n \"sku\": {\n \"name\": \"S1\",\n \"capacity\": 1\n }\n}", + "Headers": { + "x-ms-unique-id": [ "72" ], + "x-ms-client-request-id": [ "55d5387c-8c20-4e2f-a84c-3cd0ed8871f4" ], + "CommandName": [ "Update-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Update-AzTimeSeriesInsightsEnvironment_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "54" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1184" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "639afc93-98fb-49a0-8bbd-3695fd455c8c" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "7589dd39-a5c5-4602-a7d4-b4ae966b2b5f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073909Z:7589dd39-a5c5-4602-a7d4-b4ae966b2b5f" ], + "Date": [ "Wed, 08 Apr 2020 07:39:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "691" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":1},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":{},\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:30:17 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9\",\"dataAccessFqdn\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x\",\"name\":\"tsi-envv8u56x\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateStandardInputObject+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73" ], + "x-ms-client-request-id": [ "2f5c49cf-9a03-475e-a780-b6030b4971f4" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11949" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "fd475efb-c89f-41bb-a2c3-4820625a0caa" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "58ad3c47-ee51-4b72-9382-3e6759dd31c1" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073910Z:58ad3c47-ee51-4b72-9382-3e6759dd31c1" ], + "Date": [ "Wed, 08 Apr 2020 07:39:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "691" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"S1\",\"capacity\":1},\"kind\":\"Standard\",\"location\":\"eastus2\",\"tags\":{},\"properties\":{\"dataRetentionTime\":\"P1DT1H25M\",\"creationTime\":\"Wed, 08 Apr 2020 07:30:17 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9\",\"dataAccessFqdn\":\"d76a61f2-8a30-41a5-9587-f241eb9b48d9.env.timeseries.azure.com\",\"storageLimitExceededBehavior\":\"PurgeOldData\",\"partitionKeyProperties\":null},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x\",\"name\":\"tsi-envv8u56x\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateLongTerm+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "74" ], + "x-ms-client-request-id": [ "c8e18c99-c754-482b-92f9-cb4c9d83df0e" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11948" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "3490d466-64d4-4b65-97a3-365d83c5b5c2" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "8dc0ea96-4642-4975-ad25-4b3a4672d9b3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073910Z:8dc0ea96-4642-4975-ad25-4b3a4672d9b3" ], + "Date": [ "Wed, 08 Apr 2020 07:39:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "701" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":null,\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountxvtbjq\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:30:54 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3\",\"dataAccessFqdn\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk\",\"name\":\"tsi-envui70dk\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateLongTerm+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview", + "Content": "{\n \"sku\": {\n \"name\": \"L1\",\n \"capacity\": 1\n }\n}", + "Headers": { + "x-ms-unique-id": [ "75" ], + "x-ms-client-request-id": [ "e46989b6-81b3-4011-a723-b56bec81b293" ], + "CommandName": [ "Update-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Update-AzTimeSeriesInsightsEnvironment_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "54" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1183" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "a2962f94-ad46-4869-a481-e96c156e0be3" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "1fda1129-f7fd-4ab2-b7e9-189c9674c152" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073912Z:1fda1129-f7fd-4ab2-b7e9-189c9674c152" ], + "Date": [ "Wed, 08 Apr 2020 07:39:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "699" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":{},\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountxvtbjq\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:30:54 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3\",\"dataAccessFqdn\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk\",\"name\":\"tsi-envui70dk\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateLongTerm+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "76" ], + "x-ms-client-request-id": [ "95a88ffe-8456-4031-ac4b-1601a2970c77" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11947" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "6f782396-ac4b-4b1a-9c95-511e9c57b79a" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "4255239b-307c-4e5a-a0c2-d63c7e8531f1" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073912Z:4255239b-307c-4e5a-a0c2-d63c7e8531f1" ], + "Date": [ "Wed, 08 Apr 2020 07:39:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "699" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":{},\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountxvtbjq\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:30:54 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3\",\"dataAccessFqdn\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk\",\"name\":\"tsi-envui70dk\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateLongTermInputObject+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "77" ], + "x-ms-client-request-id": [ "bb50b12c-6115-49ea-9be6-a90ee400f538" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11946" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "5d351085-02c6-4975-b90e-7e6f1ba96457" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "05062b0a-371b-4c17-a8d7-8afe74e816ca" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073913Z:05062b0a-371b-4c17-a8d7-8afe74e816ca" ], + "Date": [ "Wed, 08 Apr 2020 07:39:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "699" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":{},\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountxvtbjq\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:30:54 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3\",\"dataAccessFqdn\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk\",\"name\":\"tsi-envui70dk\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateLongTermInputObject+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview", + "Content": "{\n \"sku\": {\n \"name\": \"L1\",\n \"capacity\": 1\n }\n}", + "Headers": { + "x-ms-unique-id": [ "78" ], + "x-ms-client-request-id": [ "706c923e-b9de-4a9e-99cc-d1e8c504fc51" ], + "CommandName": [ "Update-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Update-AzTimeSeriesInsightsEnvironment_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "54" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1182" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "c4a329a3-9b7e-4b1b-a134-847c8d0b4d0d" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "16632ff2-13ef-41b6-a54c-80409a32efc2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073915Z:16632ff2-13ef-41b6-a54c-80409a32efc2" ], + "Date": [ "Wed, 08 Apr 2020 07:39:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "699" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":{},\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountxvtbjq\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:30:54 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3\",\"dataAccessFqdn\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk\",\"name\":\"tsi-envui70dk\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + }, + "Update-AzTimeSeriesInsightsEnvironment+[NoContext]+UpdateLongTermInputObject+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "79" ], + "x-ms-client-request-id": [ "febf9e37-c7f5-479b-8f22-89f9d2f46a19" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEnvironment" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEnvironment_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11945" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "1b06febb-07ee-49d5-a5f9-29d936caf4e6" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "dd4b4557-d8bb-445d-8044-5598bea51cc6" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073915Z:dd4b4557-d8bb-445d-8044-5598bea51cc6" ], + "Date": [ "Wed, 08 Apr 2020 07:39:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "699" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"sku\":{\"name\":\"L1\",\"capacity\":1},\"kind\":\"LongTerm\",\"location\":\"EastUs2\",\"tags\":{},\"properties\":{\"storageConfiguration\":{\"accountName\":\"staaccountxvtbjq\"},\"timeSeriesIdProperties\":[{\"name\":\"cdc\",\"type\":\"string\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:30:54 GMT\",\"provisioningState\":\"Succeeded\",\"requestApiVersion\":\"2018-08-15-preview\",\"dataAccessId\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3\",\"dataAccessFqdn\":\"d129a8b6-772d-48a8-acdb-9ad529e7ffa3.env.timeseries.azure.com\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envui70dk\",\"name\":\"tsi-envui70dk\",\"type\":\"Microsoft.TimeSeriesInsights/Environments\"}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEnvironment.Tests.ps1 b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEnvironment.Tests.ps1 new file mode 100644 index 000000000000..8e58f5e37e05 --- /dev/null +++ b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEnvironment.Tests.ps1 @@ -0,0 +1,50 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzTimeSeriesInsightsEnvironment.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzTimeSeriesInsightsEnvironment' { + It 'UpdateStandard' { + $environmentName = $env.tsiEnvName + $tsiEnvStandard = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $environmentName + $newCapacity = $tsiEnvStandard.Capacity + 2 + Update-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.ResourceGroup -Name $environmentName -Capacity $newCapacity -Sku $tsiEnvStandard.SkuName + $updatedTsiEnv = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.ResourceGroup -Name $environmentName + $updatedTsiEnv.SkuCapacity | Should -Be $newCapacity + + } + It 'UpdateStandardInputObject' { + $environmentName = $env.tsiEnvName + $tsiEnvStandard = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $environmentName + $newCapacity = $tsiEnvStandard.Capacity + 1 + Update-AzTimeSeriesInsightsEnvironment -InputObject $tsiEnvStandard -Capacity $newCapacity -Sku $tsiEnvStandard.SkuName + $updatedTsiEnv = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.ResourceGroup -Name $environmentName + $updatedTsiEnv.SkuCapacity | Should -Be $newCapacity + } + + It 'UpdateLongTerm' { + $environmentName = $env.tsiEnvName01 + $tsiEnvLongTerm = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $environmentName + $newCapacity = $tsiEnvLongTerm.Capacity + 1 + Update-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.ResourceGroup -Name $environmentName -Capacity $newCapacity -Sku $tsiEnvLongTerm.SkuName + $updatedTsiEnv = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.ResourceGroup -Name $environmentName + $updatedTsiEnv.SkuCapacity | Should -Be $newCapacity + } + + It 'UpdateLongTermInputObject' { + $environmentName = $env.tsiEnvName01 + $tsiEnvLongTerm = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.resourceGroup -Name $environmentName + $newCapacity = $tsiEnvLongTerm.Capacity + 1 + Update-AzTimeSeriesInsightsEnvironment -InputObject $tsiEnvLongTerm -Capacity $newCapacity -Sku $tsiEnvLongTerm.SkuName + $updatedTsiEnv = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $env.ResourceGroup -Name $environmentName + $updatedTsiEnv.SkuCapacity | Should -Be $newCapacity + } +} diff --git a/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEventSource.Recording.json b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEventSource.Recording.json new file mode 100644 index 000000000000..8d02701ca893 --- /dev/null +++ b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEventSource.Recording.json @@ -0,0 +1,123 @@ +{ + "Update-AzTimeSeriesInsightsEventSource+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview", + "Content": "{\n \"tags\": {\n \"tag1\": \"001\"\n }\n}", + "Headers": { + "x-ms-unique-id": [ "80" ], + "x-ms-client-request-id": [ "4f3afb35-2f79-4d54-af64-f0700148f44b" ], + "CommandName": [ "Update-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Update-AzTimeSeriesInsightsEventSource_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "37" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1181" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "ebdd2c8c-1dd0-4347-b30c-077610d5da70" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "96c40d6f-fea2-49bc-ac61-6c68528d2b60" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073918Z:96c40d6f-fea2-49bc-ac61-6c68528d2b60" ], + "Date": [ "Wed, 08 Apr 2020 07:39:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "792" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"kind\":\"Microsoft.EventHub\",\"location\":\"eastus2\",\"tags\":{\"tag1\":\"001\"},\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-0t3khp/eventhubs/eventhubname-d2rvmp\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"eventHubName\":\"eventhubname-d2rvmp\",\"keyName\":\"RootManageSharedAccessKey\",\"serviceBusNamespace\":\"eventhubspace-0t3khp\",\"creationTime\":\"Wed, 08 Apr 2020 07:31:30 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h\",\"name\":\"tsi-esrfyi9h\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}" + } + }, + "Update-AzTimeSeriesInsightsEventSource+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "81" ], + "x-ms-client-request-id": [ "19dc189c-4198-49a7-b111-fa573b772e42" ], + "CommandName": [ "Get-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsEventSource_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11944" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "31a98095-8a9c-4386-b0ae-3716d3659725" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "f1176dd9-bd64-4ad7-a838-18e3d56f66d0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073918Z:f1176dd9-bd64-4ad7-a838-18e3d56f66d0" ], + "Date": [ "Wed, 08 Apr 2020 07:39:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "792" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"kind\":\"Microsoft.EventHub\",\"location\":\"eastus2\",\"tags\":{\"tag1\":\"001\"},\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-0t3khp/eventhubs/eventhubname-d2rvmp\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"eventHubName\":\"eventhubname-d2rvmp\",\"keyName\":\"RootManageSharedAccessKey\",\"serviceBusNamespace\":\"eventhubspace-0t3khp\",\"creationTime\":\"Wed, 08 Apr 2020 07:31:30 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h\",\"name\":\"tsi-esrfyi9h\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}" + } + }, + "Update-AzTimeSeriesInsightsEventSource+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h?api-version=2018-08-15-preview", + "Content": "{\n \"tags\": {\n \"tag2\": \"002\"\n }\n}", + "Headers": { + "x-ms-unique-id": [ "82" ], + "x-ms-client-request-id": [ "2202c98a-b1b8-46dd-8168-38076c3c295b" ], + "CommandName": [ "Update-AzTimeSeriesInsightsEventSource" ], + "FullCommandName": [ "Update-AzTimeSeriesInsightsEventSource_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "37" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1180" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "9565c863-4f9e-4a83-a87d-d5770daf0e72" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "ab9033ff-6126-4de5-8a69-08d955944495" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073920Z:ab9033ff-6126-4de5-8a69-08d955944495" ], + "Date": [ "Wed, 08 Apr 2020 07:39:20 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "792" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"kind\":\"Microsoft.EventHub\",\"location\":\"eastus2\",\"tags\":{\"tag2\":\"002\"},\"properties\":{\"eventSourceResourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-0t3khp/eventhubs/eventhubname-d2rvmp\",\"consumerGroupName\":\"tsi-test-i01k5l\",\"eventHubName\":\"eventhubname-d2rvmp\",\"keyName\":\"RootManageSharedAccessKey\",\"serviceBusNamespace\":\"eventhubspace-0t3khp\",\"creationTime\":\"Wed, 08 Apr 2020 07:31:30 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/eventsources/tsi-esrfyi9h\",\"name\":\"tsi-esrfyi9h\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/EventSources\"}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEventSource.Tests.ps1 b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEventSource.Tests.ps1 new file mode 100644 index 000000000000..f8e8b2cab674 --- /dev/null +++ b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsEventSource.Tests.ps1 @@ -0,0 +1,38 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) + +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzTimeSeriesInsightsEventSource.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzTimeSeriesInsightsEventSource' { + It 'UpdateExpanded' { + $environmentName = $env.tsiEnvName + $eventSourceName = $env.tsiEsName + $key = 'tag1' + $value = '001' + $tag = @{$key=$value} + $updateTsiEventSource = Update-AzTimeSeriesInsightsEventSource -EnvironmentName $environmentName -Name $eventSourceName -ResourceGroupName $env.ResourceGroup -Tag $tag + $updateTsiEventSource.Tag.keys.Contains($key) | Should -BeTrue + $updateTsiEventSource.Tag.Values.Contains($value) | Should -BeTrue + } + + It 'UpdateViaIdentityExpanded' { + $environmentName = $env.tsiEnvName + $eventSourceName = $env.tsiEsName + $getTsiEventSorce = Get-AzTimeSeriesInsightsEventSource -EnvironmentName $environmentName -ResourceGroupName $env.resourceGroup -Name $eventSourceName + $key = 'tag2' + $value = '002' + $tag = @{$key=$value} + $updateTsiEventSource = Update-AzTimeSeriesInsightsEventSource -InputObject $getTsiEventSorce -Tag $tag + $updateTsiEventSource.Tag.keys.Contains($key) | Should -BeTrue + $updateTsiEventSource.Tag.Values.Contains($value) | Should -BeTrue + } +} diff --git a/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsReferenceDataSet.Recording.json b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsReferenceDataSet.Recording.json new file mode 100644 index 000000000000..04d5cd50f3db --- /dev/null +++ b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsReferenceDataSet.Recording.json @@ -0,0 +1,201 @@ +{ + "Update-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview", + "Content": "{\n \"tags\": {\n \"rds01\": \"001\"\n }\n}", + "Headers": { + "x-ms-unique-id": [ "83" ], + "x-ms-client-request-id": [ "dd1d2637-6d4e-45c8-a293-c858cb284596" ], + "CommandName": [ "Update-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Update-AzTimeSeriesInsightsReferenceDataSet_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "38" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1179" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "a8d8d4a5-68bc-401a-8c2f-5e4ec8181178" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "4b560830-fb70-49c8-a891-76225f33573b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073923Z:4b560830-fb70-49c8-a891-76225f33573b" ], + "Date": [ "Wed, 08 Apr 2020 07:39:22 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "512" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus2\",\"tags\":{\"rds01\":\"001\"},\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:31:41 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij\",\"name\":\"tsirdsqwufij\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}" + } + }, + "Update-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "84" ], + "x-ms-client-request-id": [ "a6a93536-e609-4ff6-b20a-a69392f4ea81" ], + "CommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11943" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "6d290c53-4789-498f-b818-9c4d5cf42d6b" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "704540a2-1717-4988-85a5-56109bb8e0cd" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073923Z:704540a2-1717-4988-85a5-56109bb8e0cd" ], + "Date": [ "Wed, 08 Apr 2020 07:39:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "512" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus2\",\"tags\":{\"rds01\":\"001\"},\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:31:41 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij\",\"name\":\"tsirdsqwufij\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}" + } + }, + "Update-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "85" ], + "x-ms-client-request-id": [ "f12b5cc7-1226-43f4-b57c-e740fd8cf58e" ], + "CommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11942" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "538d920a-3c08-477d-8683-ccb600c15b1f" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "76adcbce-fd92-49bf-981b-f48c70ce0039" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073924Z:76adcbce-fd92-49bf-981b-f48c70ce0039" ], + "Date": [ "Wed, 08 Apr 2020 07:39:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "512" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus2\",\"tags\":{\"rds01\":\"001\"},\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:31:41 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij\",\"name\":\"tsirdsqwufij\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}" + } + }, + "Update-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview", + "Content": "{\n \"tags\": {\n \"rds02\": \"002\"\n }\n}", + "Headers": { + "x-ms-unique-id": [ "86" ], + "x-ms-client-request-id": [ "2e440118-ec3f-497d-9477-9973eb232de0" ], + "CommandName": [ "Update-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Update-AzTimeSeriesInsightsReferenceDataSet_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "38" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1178" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "8700890e-14d8-4fb6-a8d2-455e6e9df312" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "46fa8818-3a0c-400c-96dc-bef77b18847a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073926Z:46fa8818-3a0c-400c-96dc-bef77b18847a" ], + "Date": [ "Wed, 08 Apr 2020 07:39:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "512" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus2\",\"tags\":{\"rds02\":\"002\"},\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:31:41 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij\",\"name\":\"tsirdsqwufij\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}" + } + }, + "Update-AzTimeSeriesInsightsReferenceDataSet+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij?api-version=2018-08-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "87" ], + "x-ms-client-request-id": [ "3c926ccd-937c-44ca-98f3-c1a97ccd8dda" ], + "CommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet" ], + "FullCommandName": [ "Get-AzTimeSeriesInsightsReferenceDataSet_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11941" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-request-id": [ "eec96dcb-8b23-42db-8794-33e7c6a3b681" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-correlation-request-id": [ "f6ab6d0c-407a-4446-b268-1764146768fb" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200408T073926Z:f6ab6d0c-407a-4446-b268-1764146768fb" ], + "Date": [ "Wed, 08 Apr 2020 07:39:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "512" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus2\",\"tags\":{\"rds02\":\"002\"},\"properties\":{\"dataStringComparisonBehavior\":\"Ordinal\",\"keyProperties\":[{\"name\":\"device01\",\"type\":\"Double\"}],\"creationTime\":\"Wed, 08 Apr 2020 07:31:41 GMT\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.TimeSeriesInsights/environments/tsi-envv8u56x/referenceDataSets/tsirdsqwufij\",\"name\":\"tsirdsqwufij\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/ReferenceDataSets\"}" + } + } +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 new file mode 100644 index 000000000000..f9e5b51d44ed --- /dev/null +++ b/src/TimeSeriesInsights/test/Update-AzTimeSeriesInsightsReferenceDataSet.Tests.ps1 @@ -0,0 +1,40 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) + +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzTimeSeriesInsightsReferenceDataSet.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzTimeSeriesInsightsReferenceDataSet' { + It 'UpdateExpanded' { + $key = 'rds01' + $value = '001' + $tag = @{$key=$value} + $environmentName = $env.tsiEnvName + $dataSetName = $env.referenceDataSet + Update-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $environmentName -Name $dataSetName -ResourceGroupName $env.ResourceGroup -Tag $tag + $tsiDs = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $environmentName -ResourceGroupName $env.ResourceGroup -ReferenceDataSetName $dataSetName + $tsiDs.Tag.keys.Contains($key) | Should -BeTrue + $tsiDs.Tag.Values.Contains($value) | Should -BeTrue + } + + It 'UpdateViaIdentityExpanded' { + $key = 'rds02' + $value = '002' + $tag = @{$key=$value} + $environmentName = $env.tsiEnvName + $dataSetName = $env.referenceDataSet + $tsiDs = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $environmentName -ResourceGroupName $env.resourceGroup -ReferenceDataSetName $dataSetName + Update-AzTimeSeriesInsightsReferenceDataSet -InputObject $tsiDs -Tag $tag + $tsiDs = Get-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $environmentName -ResourceGroupName $env.ResourceGroup -ReferenceDataSetName $tsiDs.Name + $tsiDs.Tag.keys.Contains($key) | Should -BeTrue + $tsiDs.Tag.Values.Contains($value) | Should -BeTrue + } +} diff --git a/src/TimeSeriesInsights/test/env.json b/src/TimeSeriesInsights/test/env.json new file mode 100644 index 000000000000..5884d21d150a --- /dev/null +++ b/src/TimeSeriesInsights/test/env.json @@ -0,0 +1,50 @@ +{ + "staaccountName01": "staaccountmtudlr", + "tsiEnvName01": "tsi-envui70dk", + "iotHubName_key": "2TnzezePKCeYjruy24uA4h3YGpyXEiF8jDb+fv/Hd64=", + "rstr31": "rstr-b9adi0", + "rstres01": "rstr-ra0hqf", + "accessPolicy01": "tsi-apgxltea", + "rstrenv02": "rstr-cn1yql", + "rstres02": "rstr-l1j2ti", + "eventHubSpaceName01": "eventhubspace-p6qzi9", + "rstrds02": "rstr-dw4exm", + "rstr32": "rstr-sthco3", + "eventHubName": "eventhubname-d2rvmp", + "rstrenv05": "rstr-d2ih3p", + "rstr35": "rstr-btkj0w", + "rstr30": "rstr-j1c592", + "rstrap03": "rstr-1z0luh", + "rstres04": "rstr-drj0t6", + "tsiEnvName": "tsi-envv8u56x", + "eventHubName02_id": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.EventHub/namespaces/eventhubspace-wcukl2/eventhubs/eventhubname-x7lcry", + "resourceGroup": "tsi-test-i01k5l", + "rstr33": "rstr-otba5r", + "eventHubName02": "eventhubname-x7lcry", + "rstrap01": "rstr-hszj9q", + "tsiEsName01": "tsi-esjar3w6", + "tsiEsName": "tsi-esrfyi9h", + "rstrenv01": "rstr-8uxmh1", + "rstrenv03": "rstr-jra51c", + "rstrenv06": "rstr-uknac6", + "referenceDataSet01": "tsirdsdvgaot", + "staaccountName01_key": "M8HfaiUFYeKeVNrsDAJGz9SzYDNSmXG9jNETt/oLcxRrW5Bsz2tVPSYePMVh7qn22yyRSNu3/pMgy0QYnKQ92Q==", + "location": "eastus2", + "iotHubName_id": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-i01k5l/providers/Microsoft.Devices/IotHubs/iothubname-qnivtc", + "iotHubName": "iothubname-qnivtc", + "staaccountName": "staaccountxvtbjq", + "rstrap02": "rstr-xnycis", + "subscriptionId": "9e223dbe-3399-4e19-88eb-0975f02ac87f", + "tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "rstres03": "rstr-mklg1c", + "referenceDataSet": "tsirdsqwufij", + "eventHubSpaceName": "eventhubspace-0t3khp", + "principalObjectId": "97deab6c-e478-40b4-b4da-e7d9353dc1e8", + "eventHubSpaceName02": "eventhubspace-wcukl2", + "rstr34": "rstr-o4nkye", + "rstrds01": "rstr-hbozta", + "accessPolicy": "tsi-apilgj5y", + "eventHubName01": "eventhubname-vwrm83", + "eventHubName02_key": "YGX/J9qfyTCcC5AQr8h8xlIo4i8XZ6bySgglrDUyTuk=", + "rstrenv04": "rstr-s13wly" +} diff --git a/src/TimeSeriesInsights/test/helper.ps1 b/src/TimeSeriesInsights/test/helper.ps1 new file mode 100644 index 000000000000..0fb695d7f98b --- /dev/null +++ b/src/TimeSeriesInsights/test/helper.ps1 @@ -0,0 +1,134 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} + +function GetUseModules() { + $usedModule = & 'gmo' + foreach($module in $usedModule) + { + $name = $module.Name + $version = $module.Version + Write-Host -ForegroundColor Green "Using module name: $name $version" + } +} + +function RandomNumber([int32]$len) { + return -join (0,1,2,3,4,5,6,7,8,9 | Get-Random -Count $len | % {[int32]$_}) +} +function RandomLetters([int32]$len,[bool]$lowerCase) { + if($lowerCase) + { + return -join ((97..122) | Get-Random -Count $len | % {[char]$_}) + } + return -join ((65..90) + (97..122) | Get-Random -Count $len | % {[char]$_}) +} + +function CreateStaAccount([string]$resourceGroup, [string]$staAccountName,[string]$location, [string]$skuName) +{ + Write-Host -ForegroundColor Green 'Start creating storage account for test...' + New-AzStorageAccount -ResourceGroupName $resourceGroup -AccountName $staAccountName -Location $location -SkuName $skuName + Write-Host -ForegroundColor Green 'Created storage account successfully.' + $staAccountKeys = Get-AzStorageAccountKey -ResourceGroupName $resourceGroup -Name $staAccountName + $staAccountKey = $staAccountKeys[0].Value + return $staccountParam = @{accountName=$staAccountName; accountKey=$staAccountKey} +} + +function GetOrCreateTsiEnv([bool]$forceCreate, [string]$resourceGroup, $tsiEnvParamObj, $staccountParamObj) +{ + if(!$forceCreate) + { + $tsiEnvList = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $resourceGroup + foreach($tsiEnv in $tsiEnvList) + { + if(($tsiEnv.Kind -eq $tsiEnvParamObj.Kind) -and ($tsiEnv.SkuName -eq $tsiEnvParamObj.SkuName)) + { + Write-Host -ForegroundColor Green "Get TimeSeriesInsightsEnvironment for test from resource group." + return $tsiEnv + } + } + } + if(!$tsiEnvParamObj.TsiEnvName) + { + $tsiEnvParamObj.TsiEnvName = "tsi-env-" + (RandomLetters -len 5) + } + if(!$tsiEnvParamObj.Location) + { + $tsiEnvParamObj.Location = 'eastus' + } + if(!$tsiEnvParamObj.TimeSpan) + { + $tsiEnvParamObj.TimeSpan = New-TimeSpan -Days 1 -Hours 1 -Minutes 25 + } + if(!$tsiEnvParamObj.Capacity) + { + $tsiEnvParamObj.Capacity = 2 + } + + if($tsiEnvParamObj.Kind -eq 'LongTerm') + { + if(!$tsiEnvParamObj.TimeSeriesIdProperty) + { + $tsiEnvParamObj.TimeSeriesIdProperty = @{name='cdc';type='string'} + } + $staAccountKey = $staccountParamObj.accountKey | ConvertTo-SecureString -AsPlainText -Force + Write-Host -ForegroundColor Green 'Start creating TimeSeriesInsightsEnvironment(Kind:LongTerm) for test...' + $tsiEnv = New-AzTimeSeriesInsightsEnvironment -ResourceGroupName $resourceGroup -Name $tsiEnvParamObj.TsiEnvName -Kind $tsiEnvParamObj.Kind -Location $tsiEnvParamObj.Location -Sku $tsiEnvParamObj.SkuName -StorageAccountName $staccountParamObj.accountName -StorageAccountKey $staAccountKey -TimeSeriesIdProperty $tsiEnvParamObj.TimeSeriesIdProperty + Write-Host -ForegroundColor Green 'Created TimeSeriesInsightsEnvironment(Kind:LongTerm) successfully.' + return $tsiEnv + } + + Write-Host -ForegroundColor Green 'Start creating TimeSeriesInsightsEnvironment(Kind:Standard) for test...' + $tsiEnv = New-AzTimeSeriesInsightsEnvironment -ResourceGroupName $resourceGroup -Name $tsiEnvParamObj.TsiEnvName -Kind $tsiEnvParamObj.Kind -Location $tsiEnvParamObj.Location -Sku $tsiEnvParamObj.SkuName -DataRetentionTime $tsiEnvParamObj.TimeSpan -Capacity $tsiEnvParamObj.Capacity + #$tsiEnv = Get-AzTimeSeriesInsightsEnvironment -ResourceGroupName $resourceGroup -Name $tsiEnvParamObj.TsiEnvName + Write-Host -ForegroundColor Green 'Created TimeSeriesInsightsEnvironment(Kind:Standard) successfully.' + return $tsiEnv +} + +function CreateEventHub ([string]$eventHubSpaceName,[string]$eventHubName,[string]$resourceGroup, [string]$location) +{ + Write-Host -ForegroundColor Green 'Start creating EventHub for test...' + $eventHubSpace = New-AzEventHubNamespace -Name $eventHubSpaceName -ResourceGroupName $resourceGroup -Location $location + $eventHub = New-AzEventHub -ResourceGroupName $resourceGroup -NamespaceName $eventHubSpace.Name -Name $eventHubName + Write-Host -ForegroundColor Green 'Created EventHub successfully.' + $eventHubKeys = Get-AzEventHubKey -ResourceGroupName $resourceGroup -NamespaceName $eventHubSpace.Name -AuthorizationRuleName RootManageSharedAccessKey + $eventHubKey = $eventHubKeys.PrimaryKey + $eventhubParam = @{eventHubSpace=$eventHubSpaceName;eventhub=$eventHub;eventHubKey=$eventHubKey} + return $eventhubParam +} + +function CreateIotHub($iotHubParamObj,[string]$resourceGroup, [string]$location) +{ + if(!$iotHubParamObj.iotHubName) + { + $iotHubParamObj.iotHubName = 'rstr-' + (RandomString -allChars $false -len 6) + } + if(!$iotHubParamObj.iotHubSkuName) + { + $iotHubParamObj.iotHubSkuName = 'S1' + } + if(!$iotHubParamObj.iotUnits) + { + $iotHubParamObj.iotUnits = 100 + } + Write-Host -ForegroundColor Green 'Start creating IotHub for test...' + $iotHub = New-AzIotHub -ResourceGroupName $resourceGroup -Location $location -Name $iotHubParamObj.iotHubName -SkuName $iotHubParamObj.iotHubSkuName -Units $iotHubParamObj.iotUnits + $iotHubKeys = Get-AzIotHubKey -ResourceGroupName $resourceGroup -Name $iotHubParamObj.iotHubName + $iotHubKey = $iotHubKeys[0].PrimaryKey + Write-Host -ForegroundColor Green 'Created IotHub successfully.' + $iothubParam = @{iotHubName=$iotHubParamObj.iotHubName;iotHub=$iotHub;iotHubKey=$iotHubKey} + return $iothubParam +} + +function CreateTsiEventSource([string]$tsiEevntSourceName,[string]$resourceGroup,$tsiEnv,$eventhubParam) +{ + # eventhub need modify. + $eventHubKey = $eventhubParam.eventHubKey | ConvertTo-SecureString -AsPlainText -Force + Write-Host -ForegroundColor Green 'Start creating TimeSeriesInsightsEventSource for test...' + $tsiEventSource = New-AzTimeSeriesInsightsEventSource -ResourceGroupName $resourceGroup -Name $tsiEevntSourceName -EnvironmentName $tsiEnv.Name.ToString() -Kind Microsoft.EventHub -ConsumerGroupName $resourceGroup -Location $tsiEnv.Location -KeyName RootManageSharedAccessKey -ServiceBusNameSpace $eventhubParam.eventHubSpace -EventHubName $eventhubParam.eventHub.Name -EventSourceResourceId $eventhubParam.eventHub.id -SharedAccessKey $eventHubKey + Write-Host -ForegroundColor Green 'Created TimeSeriesInsightsEventSource successfully.' + return $tsiEventSource +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/loadEnv.ps1 b/src/TimeSeriesInsights/test/loadEnv.ps1 new file mode 100644 index 000000000000..c4ebf2e8310c --- /dev/null +++ b/src/TimeSeriesInsights/test/loadEnv.ps1 @@ -0,0 +1,28 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/readme.md b/src/TimeSeriesInsights/test/readme.md new file mode 100644 index 000000000000..1969200c6a09 --- /dev/null +++ b/src/TimeSeriesInsights/test/readme.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `../custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/src/TimeSeriesInsights/test/utils.ps1 b/src/TimeSeriesInsights/test/utils.ps1 new file mode 100644 index 000000000000..b74e03039864 --- /dev/null +++ b/src/TimeSeriesInsights/test/utils.ps1 @@ -0,0 +1,174 @@ +. ("$PSScriptRoot\helper.ps1") +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.subscriptionId = (Get-AzContext).Subscription.Id + $env.tenant = (Get-AzContext).Tenant.Id + $env.Add('principalObjectId','97deab6c-e478-40b4-b4da-e7d9353dc1e8') + # For any resources you created for test, you should add it to $env here. + $rstr01 = 'staaccount' + (RandomLetters -len 6 -lowerCase $true) + $rstr011 = 'staaccount' + (RandomLetters -len 6 -lowerCase $true) + $env.Add('staaccountName', $rstr01) + $env.Add('staaccountName01', $rstr011) + + $rstr02 = 'eventhubspace-' + (RandomString -allChars $false -len 6) + $rstr021 = 'eventhubspace-' + (RandomString -allChars $false -len 6) + $rstr022 = 'eventhubspace-' + (RandomString -allChars $false -len 6) + $rstr03 = 'eventhubname-' + (RandomString -allChars $false -len 6) + $rstr031 = 'eventhubname-' + (RandomString -allChars $false -len 6) + $rstr032 = 'eventhubname-' + (RandomString -allChars $false -len 6) + $env.Add('eventHubSpaceName', $rstr02) + $env.Add('eventHubSpaceName01', $rstr021) + $env.Add('eventHubSpaceName02', $rstr022) + $env.Add('eventHubName', $rstr03) + $env.Add('eventHubName01', $rstr031) + $env.Add('eventHubName02', $rstr032) + + $rstr04 = 'iothubname-' + (RandomString -allChars $false -len 6) + $env.Add('iotHubName', $rstr04) + + $rstr05 = 'tsi-env' + (RandomString -allChars $false -len 6) + $rstr051 = 'tsi-env' + (RandomString -allChars $false -len 6) + $env.Add('tsiEnvName', $rstr05) + $env.Add('tsiEnvName01', $rstr051) + + $rstr06 = 'tsi-es' + (RandomString -allChars $false -len 6) + $rstr061 = 'tsi-es' + (RandomString -allChars $false -len 6) + $env.Add('tsiEsName', $rstr06) + $env.Add('tsiEsName01', $rstr061) + + $rstr07 = 'tsi-ap' + (RandomString -allChars $false -len 6) + $rstr071 = 'tsi-ap' + (RandomString -allChars $false -len 6) + $env.Add('accessPolicy', $rstr07) + $env.Add('accessPolicy01', $rstr071) + + $rstr08 = 'tsirds' + (RandomLetters -len 6 -lowerCase $true) + $rstr081 = 'tsirds' + (RandomLetters -len 6 -lowerCase $true) + $env.Add('referenceDataSet', $rstr08) + $env.Add('referenceDataSet01', $rstr081) + + # Generate some random strings for use in the test. + $rstrenv01 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstrenv02 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstrenv03 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstrenv04 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstrenv05 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstrenv06 = 'rstr-' + (RandomString -allChars $false -len 6) + $env.Add('rstrenv01', $rstrenv01) + $env.Add('rstrenv02', $rstrenv02) + $env.Add('rstrenv03', $rstrenv03) + $env.Add('rstrenv04', $rstrenv04) + $env.Add('rstrenv05', $rstrenv05) + $env.Add('rstrenv06', $rstrenv06) + + $rstres01 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstres02 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstres03 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstres04 = 'rstr-' + (RandomString -allChars $false -len 6) + $env.Add('rstres01', $rstres01) + $env.Add('rstres02', $rstres02) + $env.Add('rstres03', $rstres03) + $env.Add('rstres04', $rstres04) + + $rstrap01 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstrap02 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstrap03 = 'rstr-' + (RandomString -allChars $false -len 6) + $env.Add('rstrap01', $rstrap01) + $env.Add('rstrap02', $rstrap02) + $env.Add('rstrap03', $rstrap03) + + $rstrds01 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstrds02 = 'rstr-' + (RandomString -allChars $false -len 6) + $env.Add('rstrds01', $rstrds01) + $env.Add('rstrds02', $rstrds02) + + + $rstr30 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstr31 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstr32 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstr33 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstr34 = 'rstr-' + (RandomString -allChars $false -len 6) + $rstr35 = 'rstr-' + (RandomString -allChars $false -len 6) + $env.Add('rstr30', $rstr30) + $env.Add('rstr31', $rstr31) + $env.Add('rstr32', $rstr32) + $env.Add('rstr33', $rstr33) + $env.Add('rstr34', $rstr34) + $env.Add('rstr35', $rstr35) + + # create resource group for test. + $resourceGroup = 'tsi-test-' + (RandomString -allChars $false -len 6) + $Location = 'eastus2' + Write-Host -ForegroundColor Green 'Start creating resource group for test...' + New-AzResourceGroup -Name $resourceGroup -Location $Location + $env.Add('resourceGroup', $resourceGroup) + $env.Add('location', $Location) + Write-Host -ForegroundColor Green 'Resource group created successfully.' + + Write-Host -ForegroundColor Green '--------------------------------------------' + Write-Host -ForegroundColor Green 'Start deploying resources for testing.' + # create storage account for test. + $staAccountParam = (CreateStaAccount -staAccountName $env.staaccountName -resourceGroup $env.resourceGroup -location $env.location -Sku Standard_GRS) + $staAccountParam01 = (CreateStaAccount -staAccountName $env.staaccountName01 -resourceGroup $env.resourceGroup -location $env.location -Sku Standard_GRS) + $env.Add('staaccountName01_key', $staAccountParam01.accountKey) + + # create eventhub for test. + $eventHubParam = (CreateEventHub -eventHubSpaceName $env.eventHubSpaceName -eventHubName $env.eventHubName -resourceGroup $env.resourceGroup -location $env.location) + $eventHubParam01 = (CreateEventHub -eventHubSpaceName $env.eventHubSpaceName01 -eventHubName $env.eventHubName01 -resourceGroup $env.resourceGroup -location $env.location) + $eventHubParam02 = (CreateEventHub -eventHubSpaceName $env.eventHubSpaceName02 -eventHubName $env.eventHubName02 -resourceGroup $env.resourceGroup -location $env.location) + $env.Add('eventHubName02_id', $eventHubParam02.eventhub.id) + $env.Add('eventHubName02_key', $eventHubParam02.eventHubKey) + + # create iothub for test. + $iotHubParam = @{iotHubName=$env.iotHubName} + $iothub = (CreateIotHub -iotHubParamObj $iotHubParam -resourceGroup $env.resourceGroup -location $env.location) + $env.Add('iotHubName_id', $iothub.iotHub.id) + $env.Add('iotHubName_key', $iothub.iotHubKey) + + + # create TimeSeriesInsightsEnvironment for test. + $tsiEnvParamObj = @{TsiEnvName = $env.tsiEnvName;Kind='Standard'; SkuName='S1'; Location=$env.location} + $tsiEnvParamObj01 = @{TsiEnvName = $env.tsiEnvName01;Kind='LongTerm'; SkuName='L1'; Location=$env.location} + $tsiEnv = (GetOrCreateTsiEnv -forceCreate $true -tsiEnvParamObj $tsiEnvParamObj -resourceGroup $env.resourceGroup) + $tsiEnv01 = (GetOrCreateTsiEnv -forceCreate $true -tsiEnvParamObj $tsiEnvParamObj01 -resourceGroup $env.resourceGroup -staccountParamObj $staAccountParam) + + # create AzTimeSeriesInsightsEventSource(Kind:EventHub) for test. + $tsiEs = (CreateTsiEventSource -tsiEevntSourceName $env.tsiEsName -resourceGroup $env.resourceGroup -tsiEnv $tsiEnv -eventhubParam $eventHubParam) + $tsiEs01 = (CreateTsiEventSource -tsiEevntSourceName $env.tsiEsName01 -resourceGroup $env.resourceGroup -tsiEnv $tsiEnv01 -eventhubParam $eventHubParam01) + + # create AzTimeSeriesInsightsAccessPolicy for test. + Write-Host -ForegroundColor Green 'Start creating AzTimeSeriesInsightsAccessPolicy for test...' + $role = 'Reader' + New-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup -PrincipalObjectId $env.principalObjectId -Role $role -Name $env.accessPolicy + New-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $env.tsiEnvName01 -ResourceGroupName $env.resourceGroup -PrincipalObjectId $env.principalObjectId -Role $role -Name $env.accessPolicy01 + Write-Host -ForegroundColor Green 'AzTimeSeriesInsightsAccessPolicy created successfully.' + + # create AzTimeSeriesInsightsAccessPolicy for test. + Write-Host -ForegroundColor Green 'Start creating AzTimeSeriesInsightsReferenceDataSet for test...' + $mykeyproperties = @{ "name" = "device01"; "type" = "Double"} + New-AzTimeSeriesInsightsReferenceDataSet -EnvironmentName $env.tsiEnvName -Name $env.referenceDataSet -ResourceGroupName $env.resourceGroup -Location $env.location -DataStringComparisonBehavior Ordinal -KeyProperty $mykeyproperties + Write-Host -ForegroundColor Green 'AzTimeSeriesInsightsReferenceDataSet created successfully.' + + Write-Host -ForegroundColor Green 'Deployment complete.' + Write-Host -ForegroundColor Green '--------------------------------------------' + + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) + +} +function cleanupEnv() { + # Clean resources you create for testing + Remove-AzResourceGroup -Name $env.resourceGroup +} +