Skip to content

Commit bc344da

Browse files
VeryEarlyaygoyaisra-feljagilberFiliz Topatan
authored
Monitor private link (#11407)
* typo, unused imports. - enable severity, status tests. update properties count( since prod outage was removed). add tests for ticket status. * properties count to 5 * count for prob class to 5 * fix get-azresource -ResourceGroupName -Name -ResourceType to use correct ApiVersion * Complete cmdlet implementations * fix get-azresource -ResourceGroupName -Name -ExpandProperties -ResourceType to use correct ApiVersion * Fix Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.dll.json #10826 * Fix changelog merge issue * remove override DefaultContext * Restore-AzSqlInstanceDatabase - fix "an" -> "a" Examples: fix "an deleted instance" to "a deleted instance" * Add changelog entry * chore) update privacy notice text * Update changelog.md per contributing.md * chore) minor text correction * Improve PolicyInsights error messages * Address reviwer comments * Add note about the version of PowerShell * fix changelog merge error * Minor helper file fix * update macos to 10.14 * Add DisableAzureSqlServerActiveDirectoryOnlyAuthentication.cs file itself. * Add DisableAzureSqlServerActiveDirectoryOnlyAuthentication.cs file itself. * disable one test case that is unstable on linux * remove file * add DisableAzureSqlServerActiveDirectoryOnlyAuthentication.cs * Create DisableAzureSqlServerActiveDirectoryOnlyAuthentication.cs * Update ChangeLog.md add cmdlet Disable-AzSqlServerActiveDirectoryOnlyAuthentication * Update ChangeLog.md * SAP AEM: add support for the new VM Extension for SAP * Update ChangeLog.md remove edit to this file * Update ChangeLog.md * Add cmdlet Disable-AzSqlServerActiveDirectoryOnlyAuthentication to upcoming section. * Fixing the parameter name IsAzureADOnlyAuthentication and documentation * reprotect and Update bug fixes * add an alias to avoid breaking change * Update the azure powershell developer guide with autorest powershell generator related materials * Update the category. * change log * Update syntax in help files. * Update C# SDK to throw Cloud Exception, Update default SKU to be ST2 * Escape single quote * add TestGetResourceByNameAndType test for apiversion check * updating tests and adding completer * fix changelog merge error * updating help files and tests * add breaking changes * Update files * Update encoding to UTF8 * Add breaking changes (#11329) * add breaking changes * Change useragent to align to Az3.0 modules * Update Get-AzResourceLock.md Added an example that uses the -AtScope parameter. * Update ChangeLog.md * Consume modified SDK clients. * Remove unnecessary changes. * Fix doc Microsot→Microsoft add dot * Add a test case for Save-AzDeploymentScript cmdlet; update test recordings; update help messages; address reviewer comments * Remove duplicate cmdlet names in Az.Resources.psd1 * Add change log comment * Update Network SDK & test recordings * add license header to ArrayExtension.cs * Update New-AzNetworkInterface.md Removed reference to the manual subnet entry and added code to allow retrieval of subnetID via PowerShell from Virtual Network. This would be a best practice rather than hard-coding subnet ID entry. * Updated error messages and help files. - Share service provided details for 4xx HTTP status codes - Updated help file examples to be accurate and consistent * Update tests, tests records and help files. * Update New-AzVmss for AutomaticRepairsPolicy issue. * Update Compute SDK version to 33.0.0 * Updated CosmosDB Management version * Updated TEE type name VSMEnclave to VBSEnclave * Updated ChangeLog * Removed the new version header from ChangeLog * Added option of Byte encoding for New-AzDataLakeStoreItem, Add-AzDAtaLakeStoreItemContent, Get-AzDAtaLakeStoreItemContent * Update URLs in help files * AppGw recordings * Updated CosmosDB Management SDK version (#11351) * Updated CosmosDB Management version * Updated ChangeLog * Removed the new version header from ChangeLog Co-authored-by: Meha Kaushik <[email protected]> * [ASR] [V2A] Adding properties for VMware DR monitoring * Update * bump up version * Fix the bug that RunVerioncontroller.ps1 act different under different directory. * CredSan suppression * Update tests file. * Adding SensitivityRank parameter to DataClassification Set Cmdlets * Update syntax in help files. * Consume modified SDK clients. * Remove unnecessary changes. * Update tests, tests records and help files. * Update tests file. * Update ChangeLog.md * Update Management.Sql package version * Add rerun support to create pipeline run cmdlet * Update changeLog * Fix * addressing review comments * ChangeLog update * add comment, add byte encoding for auto completion * 1.Support customers specify min TLS version when creating cluster 2. Update New-AzHDInsightConfig.md * Added retrying policy update * updated paramsets and added help file * Fix after merge * initial commit for monitor privatelink scope * initital commit * Updated cmdlets with disk exclusion parameters * Added test coverage * Added ExcludeAllDataDisks Parameter * Added disk exclusion tests * updated markdown help * updated param sets * fixed tests * Added unmanaged vm restore warning * Updated Markdown Help file * updated tests * Update README.md * Fixing bugs and Allowing Gremlin, Cassandra, Table api account creation * Allow Encryption property to Target parameter of New-AzGalleryImageVersion cmdlet Add the following parameters to New-AzDiskConfig: DiskIOPSReadOnly, DiskMBpsReadOnly, MaxSharesCount, GalleryImageReference Fix tempDisk issue * suppress breaking change issue from int to long * Update Set-AzApiManagementGroup.md GroupId is a required parameter, please add this in the example as well. * Replace Sql client using generic rest client * Update change log * Fixing Cassandra schema and Mongo shard key null values * Adding in ChangeLog * Updated Help * add automapper assembly * Revise according to review * add mapper * remove unused util class * remove incorrect management sdk * updated param help messages * add cmdlets for private link scope * updated markdown help files with examples * update cmdlet syntax * Update ChangeLog.md fix readme * Polish changelog * Comment out the exportchildproperties test in aliastest of testfilesystem, and unskip the adlstest.testfilesystem * Rephrase changelog * add cmdlets for private link scope scoped resource * undo unexpected delete * update access modifier to public for private link related cmdlets * update access modifier to public for private link related models * fix cmdlet names * update to apply new generated SDK * fix typo * add monitor provider * Update ChangeLog.md Move changelog from version 1.4 to upcoming release. * fix parameters of private link scope related cmdlets * update parameters to apply new generated SDK * change to lowercase * apply updated SDK * remove unused cmdlet, change LinkedResourceId to mandatory * add test cases for private-link-scope * update test case * add AutoMapper back * apply SDK back * apply SDK back * add microsoft.insights/privatelinkscopes as provider for private link resource * cmdlets from Az.Network in Az.Monitor test cases won't work, try add Network SDK as dependency * add network management client in test controller * add new generated SDK * typo * use new generated SDK * typo * upgrade SDK version * generate help markdown files for private link scope * remove test nupkg * fix test * add recorded test * fix bad help * update changelog.md * try upgrade monitor sdk reference in sql.Test.csproj * fix test case * add operational insights to monitor.sln * typo * add network into monitor.sln * add management clients also in playback mode * test fix * update record json * suppress breaking change issues * rename privatelinkscopescopedresource to privatelinkscopedresource * record test * polish changelog.md * hide private endpoint connection from private link scope Co-authored-by: aygoya <[email protected]> Co-authored-by: Yeming Liu <[email protected]> Co-authored-by: Jason Gilbertson <[email protected]> Co-authored-by: Filiz Topatan <[email protected]> Co-authored-by: msJinLei <[email protected]> Co-authored-by: Dingmeng Xue <[email protected]> Co-authored-by: Hans De Mulder <[email protected]> Co-authored-by: Anthony Martin <[email protected]> Co-authored-by: Sudhindra Kovalam <[email protected]> Co-authored-by: Chris Eggert <[email protected]> Co-authored-by: Damien Caro <[email protected]> Co-authored-by: Yeming Liu <[email protected]> Co-authored-by: Nilambari <[email protected]> Co-authored-by: Nilambari <[email protected]> Co-authored-by: Amol Agarwal <[email protected]> Co-authored-by: Amol Agarwal <[email protected]> Co-authored-by: Yunchi Wang <[email protected]> Co-authored-by: MSSedusch <[email protected]> Co-authored-by: ayfathim <[email protected]> Co-authored-by: Xiaogang Ding <[email protected]> Co-authored-by: bashahee <[email protected]> Co-authored-by: Teng Lu <[email protected]> Co-authored-by: shahbj79 <[email protected]> Co-authored-by: Bhavin Shah <[email protected]> Co-authored-by: [email protected] <[email protected]> Co-authored-by: Peter Lorenzen <[email protected]> Co-authored-by: Ikko Ashimine <[email protected]> Co-authored-by: erich-wang <[email protected]> Co-authored-by: Anton Evseev <[email protected]> Co-authored-by: Thomas Thornton <[email protected]> Co-authored-by: gkostal <[email protected]> Co-authored-by: Hyonho Lee <[email protected]> Co-authored-by: Meha Kaushik <[email protected]> Co-authored-by: Rahul Dutta <[email protected]> Co-authored-by: Meha Kaushik <[email protected]> Co-authored-by: Vidyadhari Jami <[email protected]> Co-authored-by: wyunchi-ms <[email protected]> Co-authored-by: bashahee <[email protected]> Co-authored-by: lijzha <[email protected]> Co-authored-by: Jin Lei <[email protected]> Co-authored-by: Zhenyu Zhou <[email protected]> Co-authored-by: sambitratha <[email protected]> Co-authored-by: Sambit Rath <[email protected]> Co-authored-by: erwinkramer <[email protected]> Co-authored-by: Yeming Liu <[email protected]>
1 parent 58ded2b commit bc344da

37 files changed

+8569
-14
lines changed

src/Monitor/Monitor.Test/Monitor.Test.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.Monitor" Version="0.24.1-preview" />
14+
<PackageReference Include="Microsoft.Azure.Management.Monitor" Version="0.25.0-preview" />
1515
<PackageReference Include="Microsoft.Azure.Management.ApplicationInsights" Version="0.2.0-preview" />
16+
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.19.0-preview" />
17+
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.19.0-preview" />
1618
</ItemGroup>
1719

1820
<ItemGroup>

src/Monitor/Monitor.Test/ScenarioTests/Common.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,35 @@ function Clean-ResourceGroup($rgname)
7777
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback) {
7878
Remove-AzResourceGroup -Name $rgname -Force
7979
}
80+
}
81+
82+
<#
83+
.SYNOPSIS
84+
Sleeps but only during recording.
85+
#>
86+
function Start-TestSleep($milliseconds)
87+
{
88+
if ((Get-MonitorTestMode) -ne 'Playback')
89+
{
90+
Start-Sleep -Milliseconds $milliseconds
91+
}
92+
}
93+
94+
<#
95+
.SYNOPSIS
96+
Gets test mode - 'Record' or 'Playback'
97+
#>
98+
function Get-MonitorTestMode {
99+
try {
100+
$testMode = [Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode;
101+
$testMode = $testMode.ToString();
102+
} catch {
103+
if ($PSItem.Exception.Message -like '*Unable to find type*') {
104+
$testMode = 'Record';
105+
} else {
106+
throw;
107+
}
108+
}
109+
110+
return $testMode
80111
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.ServiceManagement.Common.Models;
16+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
17+
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
18+
using Xunit;
19+
20+
namespace Microsoft.Azure.Commands.Insights.Test.ScenarioTests
21+
{
22+
public class PrivateLinkScopeTests : RMTestBase
23+
{
24+
public XunitTracingInterceptor _logger;
25+
26+
public PrivateLinkScopeTests(Xunit.Abstractions.ITestOutputHelper output)
27+
{
28+
_logger = new XunitTracingInterceptor(output);
29+
XunitTracingInterceptor.AddToContext(_logger);
30+
}
31+
32+
[Fact]
33+
[Trait(Category.AcceptanceType, Category.CheckIn)]
34+
public void TestPrivateLinkScopeCRUD()
35+
{
36+
TestsController.NewInstance.RunPsTest(_logger, "Test-PrivateLinkScopeCRUD");
37+
}
38+
39+
[Fact]
40+
[Trait(Category.AcceptanceType, Category.CheckIn)]
41+
public void TestPrivateLinkScopedResourceCRUD()
42+
{
43+
TestsController.NewInstance.RunPsTest(_logger, "Test-PrivateLinkScopedResourceCRUD");
44+
}
45+
}
46+
}
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
function Test-PrivateLinkScopeCRUD
16+
{
17+
# setup
18+
$rg_name = Get-ResourceGroupName
19+
20+
$scope_name1 = Get-ResourceName
21+
$scope_name2 = Get-ResourceName
22+
$scope_name3 = Get-ResourceName
23+
24+
$config_name = Get-ResourceName
25+
$vnet_name = Get-ResourceName
26+
$connection_name = Get-ResourceName
27+
$endpoint_name = Get-ResourceName
28+
29+
$key1 = "key1"
30+
$key2 = "key2"
31+
$key3 = "key3"
32+
33+
$val1 = "val1"
34+
$val2 = "val2"
35+
$val3 = "val3"
36+
37+
$tag1 = $key1+":"+$val1
38+
$tag2 = $key2+":"+$val2
39+
$tag3 = $key3+":"+$val3
40+
41+
try
42+
{
43+
#create resource group
44+
New-AzResourceGroup -Name $rg_name -Location "westus"
45+
46+
#create private link scope
47+
New-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name1 -Location "global"
48+
New-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name2 -Location "global"
49+
New-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name3 -Location "global"
50+
51+
#get private link scope
52+
$scope1 = Get-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name1
53+
$scope2 = Get-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name2
54+
$scope3 = Get-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name3
55+
56+
Assert-NotNull $scope1
57+
Assert-NotNull $scope2
58+
Assert-NotNull $scope3
59+
60+
Assert-AreEqual $scope_name1 $scope1.Name
61+
Assert-AreEqual $scope_name2 $scope2.Name
62+
Assert-AreEqual $scope_name3 $scope3.Name
63+
64+
Assert-AreEqual "Succeeded" $scope1.ProvisioningState
65+
Assert-AreEqual "Succeeded" $scope2.ProvisioningState
66+
Assert-AreEqual "Succeeded" $scope3.ProvisioningState
67+
68+
#update private link scope
69+
$scope1 = Update-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name1 -Tags $tag1
70+
$scope2 = Update-AzInsightsPrivateLinkScope -ResourceId $scope2.Id -Tags $tag2
71+
$scope3 = $scope3 | Update-AzInsightsPrivateLinkScope -Tags $tag3
72+
73+
$valout1 = "abracadabra"
74+
$valout2 = "abracadabra"
75+
$valout3 = "abracadabra"
76+
77+
$scope1.Tags.TryGetValue($key1, [ref]$valout1)
78+
$scope2.Tags.TryGetValue($key2, [ref]$valout2)
79+
$scope3.Tags.TryGetValue($key3, [ref]$valout3)
80+
81+
Assert-AreEqual $val1 $valout1
82+
Assert-AreEqual $val2 $valout2
83+
Assert-AreEqual $val3 $valout3
84+
85+
#get/list private-link-resource
86+
$private_link_resource = Get-AzPrivateLinkResource -PrivateLinkResourceId $scope1.Id
87+
88+
Assert-NotNull $private_link_resource
89+
Assert-AreEqual 'azuremonitor' $private_link_resource[0].GroupId
90+
91+
#create private endpoint connection
92+
$subnetConfig = New-AzVirtualNetworkSubnetConfig -Name $config_name -AddressPrefix "11.0.1.0/24" -PrivateEndpointNetworkPolicies "Disabled"
93+
New-AzVirtualNetwork -ResourceGroupName $rg_name -Name $vnet_name -Location "eastus2euap" -AddressPrefix "11.0.0.0/16" -Subnet $subnetConfig
94+
$vnet=Get-AzVirtualNetwork -Name $vnet_name -ResourceGroupName $rg_name
95+
$plsConnection = New-AzPrivateLinkServiceConnection -Name $connection_name -PrivateLinkServiceId $scope1.Id -GroupId $private_link_resource[0].GroupId
96+
New-AzPrivateEndpoint -ResourceGroupName $rg_name -Name $endpoint_name -Location "eastus2euap" -Subnet $vnet.subnets[0] -PrivateLinkServiceConnection $plsConnection -ByManualRequest
97+
98+
$connection = Get-AzPrivateEndpointConnection -PrivateLinkResourceId $scope1.Id
99+
100+
Assert-NotNull $connection
101+
Assert-AreEqual "Pending" $connection.PrivateLinkServiceConnectionState.Status
102+
103+
$connectionApprove = Approve-AzPrivateEndpointConnection -ResourceId $connection.Id
104+
Assert-NotNull $connectionApprove;
105+
Assert-AreEqual "Approved" $connectionApprove.PrivateLinkServiceConnectionState.Status
106+
107+
Start-TestSleep 20000
108+
109+
$connectionRemove = Remove-AzPrivateEndpointConnection -ResourceId $connection.Id -PassThru -Force
110+
Assert-AreEqual true $connectionRemove
111+
112+
Start-TestSleep 15000
113+
114+
$connection2 = Get-AzPrivateEndpointConnection -PrivateLinkResourceId $scope1.Id
115+
Assert-Null $connection2
116+
117+
#delete private link scope
118+
$delete1 = Remove-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name1
119+
$delete2 = Remove-AzInsightsPrivateLinkScope -ResourceId $scope2.Id
120+
$delete3 = $scope3 | Remove-AzInsightsPrivateLinkScope
121+
122+
Assert-AreEqual true $delete1
123+
Assert-AreEqual true $delete2
124+
Assert-AreEqual true $delete3
125+
}
126+
catch
127+
{
128+
throw $_;
129+
}
130+
finally
131+
{
132+
# Cleanup
133+
Clean-ResourceGroup $rg_name;
134+
}
135+
}
136+
137+
function Test-PrivateLinkScopedResourceCRUD
138+
{
139+
# setup
140+
$rg_name = Get-ResourceGroupName
141+
142+
$scope_name1 = Get-ResourceName
143+
$scope_name2 = Get-ResourceName
144+
145+
$la_name = Get-ResourceName
146+
$ai_name = Get-ResourceName
147+
148+
$scoped_resource_name1 = Get-ResourceName
149+
$scoped_resource_name2 = Get-ResourceName
150+
151+
try
152+
{
153+
#create resource group
154+
New-AzResourceGroup -Name $rg_name -Location "westus"
155+
156+
#create private link scope
157+
New-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name1 -Location "global"
158+
New-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name2 -Location "global"
159+
160+
#create LA workspace
161+
$la = New-AzOperationalInsightsWorkspace -ResourceGroupName $rg_name -Name $la_name -Location "eastus"
162+
163+
#create AI component
164+
$ai = New-AzApplicationInsights -ResourceGroupName $rg_name -Name $ai_name -Location "eastus"
165+
166+
#create scoped resource for AI/LA
167+
New-AzInsightsPrivateLinkScopedResource -LinkedResourceId $ai.Id -ResourceGroupName $rg_name -ScopeName $scope_name1 -Name $scoped_resource_name1
168+
New-AzInsightsPrivateLinkScopedResource -LinkedResourceId $la.ResourceId -ResourceGroupName $rg_name -ScopeName $scope_name2 -Name $scoped_resource_name2
169+
170+
#get scoped resource
171+
$scoped_resource1 = Get-AzInsightsPrivateLinkScopedResource -ResourceGroupName $rg_name -ScopeName $scope_name1 -Name $scoped_resource_name1
172+
$scoped_resource2 = Get-AzInsightsPrivateLinkScopedResource -ResourceGroupName $rg_name -ScopeName $scope_name2 -Name $scoped_resource_name2
173+
174+
Assert-NotNull $scoped_resource1
175+
Assert-NotNull $scoped_resource2
176+
Assert-AreEqual $ai.Id $scoped_resource1.LinkedResourceId
177+
Assert-AreEqual $la.ResourceId $scoped_resource2.LinkedResourceId
178+
179+
#delete scoped resource
180+
$delete1 = Remove-AzInsightsPrivateLinkScopedResource -ResourceGroupName $rg_name -ScopeName $scope_name1 -Name $scoped_resource_name1
181+
$delete2 = Remove-AzInsightsPrivateLinkScopedResource -ResourceGroupName $rg_name -ScopeName $scope_name2 -Name $scoped_resource_name2
182+
183+
Assert-AreEqual true $delete1
184+
Assert-AreEqual true $delete2
185+
186+
Remove-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name1
187+
Remove-AzInsightsPrivateLinkScope -ResourceGroupName $rg_name -Name $scope_name2
188+
}
189+
catch
190+
{
191+
throw $_
192+
}
193+
finally
194+
{
195+
# Cleanup
196+
Clean-ResourceGroup $rg_name;
197+
}
198+
}

0 commit comments

Comments
 (0)