Skip to content

Commit 3688c00

Browse files
committed
Merge branch 'master' of https://github.com/Azure/azure-powershell into manual-failover
2 parents 0d15704 + a36c72f commit 3688c00

File tree

95 files changed

+10677
-3952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+10677
-3952
lines changed

src/ApiManagement/ApiManagement/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020
## Upcoming Release
2121
* Update `-Format` parameter description in `Set-AzApiManagementPolicy` reference documentation
22+
* Removed references of deprecated cmdlet `Update-AzApiManagementDeployment` from reference documentation. Use `Set-AzApiManagement` instead.
2223

2324
## Version 1.3.0
2425
* Fixed miscellaneous typos across module

src/ApiManagement/ApiManagement/help/Add-AzApiManagementRegion.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Add-AzApiManagementRegion -ApiManagement <PsApiManagement> -Location <String> [-
2222
## DESCRIPTION
2323
The **Add-AzApiManagementRegion** cmdlet adds new instance of type **PsApiManagementRegion** to the collection of **AdditionalRegions** of provided instance of type **Microsoft.Azure.Commands.ApiManagement.Models.PsApiManagement**.
2424
This cmdlet does not deploy anything by itself but updates instance of **PsApiManagement** in-memory.
25-
To update a deployment of an API Management pass the modified **PsApiManagement** Instance to Update-AzApiManagementDeployment.
25+
To update a deployment of an API Management pass the modified **PsApiManagement** Instance to Set-AzApiManagement.
2626

2727
## EXAMPLES
2828

@@ -34,8 +34,10 @@ PS C:\>Add-AzApiManagementRegion -ApiManagement $ApiManagement -Location "East U
3434
This command adds two premium SKU units and the region named East US to the **PsApiManagement** instance.
3535

3636
### Example 2: Add new deployment regions to a PsApiManagement instance and then update deployment
37-
```
38-
PS C:\>Get-AzApiManagement -ResourceGroupName "Contoso" -Name "ContosoApi" | Add-AzApiManagementRegion -Location "East US" -Sku "Premium" -Capacity 2 | Update-AzApiManagementDeployment
37+
```powershell
38+
PS C:\>$service = Get-AzApiManagement -ResourceGroupName "Contoso" -Name "ContosoApi"
39+
PS C:\>$service = Add-AzApiManagementRegion -ApiManagement $service -Location $secondarylocation -VirtualNetwork $additionalRegionVirtualNetwork
40+
PS C:\>$service = Set-AzApiManagement -InputObject $service -PassThru
3941
```
4042

4143
This command gets a **PsApiManagement** object, adds two premium SKU units for the region named East US, and then updates deployment.
@@ -159,6 +161,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
159161
160162
[Update-AzApiManagementRegion](./Update-AzApiManagementRegion.md)
161163
162-
[Update-AzApiManagementDeployment](./Update-AzApiManagementDeployment.md)
164+
[Set-AzApiManagement](./Set-AzApiManagement.md)
163165
164166

src/ApiManagement/ApiManagement/help/New-AzApiManagementVirtualNetwork.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,28 @@ New-AzApiManagementVirtualNetwork -SubnetResourceId <String> [-DefaultProfile <I
2020

2121
## DESCRIPTION
2222
The **New-AzApiManagementVirtualNetwork** cmdlet is a helper command to create an instance of **PsApiManagementVirtualNetwork**.
23-
This command is used with **Update-AzApiManagementDeployment** cmdlet.
23+
This command is used with **Set-AzApiManagement** and **New-AzApiManagement** cmdlet.
2424

2525
## EXAMPLES
2626

27-
### Example 1: Create a virtual network
27+
### Example 1: Create a virtual network and Update an existing APIM service into the VNET
28+
```powershell
29+
PS C:\> $virtualNetwork = New-AzApiManagementVirtualNetwork -Location "East US" -SubnetResourceId "/subscriptions/a8ff56dc-3bc7-4174-a1e8-3726ab15d0e2/resourceGroups/Api-Default-WestUS/providers/Microsoft.Network/virtualNetworks/dfVirtualNetwork/subnets/backendSubnet"
30+
PS C:\> $apim = Get-AzApiManagement -ResourceGroupName "ContosoGroup" -Name "ContosoApi"
31+
PS C:\> $apim.VpnType = "External"
32+
PS C:\> $apim.VirtualNetwork = $virtualNetwork
33+
PS C:\> Set-AzApiManagement -InputObject $apim
2834
```
29-
PS C:\>$vnetName = "myvnet"
30-
PS C:\>$subnetName = "default"
31-
PS C:\>$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.1.0/24
32-
PS C:\>$vnet = New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $resourceGroupName -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $subnet
3335

34-
# Create a Virtual Network Object
35-
PS C:\>$virtualNetwork = New-AzApiManagementVirtualNetwork -Location $location -SubnetResourceId $vnet.Subnets[0].Id
36+
This example creates a virtual network and then calls the **Set-AzApiManagement** cmdlet.
3637

37-
# Get the service
38-
PS C:\>$service = Get-AzApiManagement -ResourceGroupName $resourceGroupName -Name $apiManagementName
39-
PS C:\>$service.VirtualNetwork = $virtualNetwork
40-
PS C:\>$service.VpnType = "External"
41-
42-
# Update the Deployment with Virtual Network
43-
PS C:\>Update-AzApiManagementDeployment -ApiManagement $service
38+
### Example 2: Create an API Management service for an external virtual network
39+
```powershell
40+
PS C:\> $virtualNetwork = New-AzApiManagementVirtualNetwork -Location "West US" -SubnetResourceId "/subscriptions/a8ff56dc-3bc7-4174-b1e8-3726ab15d0e2/resourceGroups/ContosoGroup/providers/Microsoft.Network/virtualNetworks/westUsVirtualNetwork/subnets/backendSubnet"
41+
PS C:\> New-AzApiManagement -ResourceGroupName "ContosoGroup" -Location "West US" -Name "ContosoApi" -Organization Contoso -AdminEmail [email protected] -VirtualNetwork $virtualNetwork -VpnType "External" -Sku "Premium"
4442
```
4543

46-
This example creates a virtual network and then calls the **Update-AzApiManagementDeployment** cmdlet.
44+
This example creates a new APIM service into a Virtual Network in `External` mode
4745

4846
## PARAMETERS
4947

@@ -92,5 +90,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
9290
9391
## RELATED LINKS
9492
95-
[Update-AzApiManagementDeployment](./Update-AzApiManagementDeployment.md)
93+
[Set-AzApiManagement](./Set-AzApiManagement.md)
94+
[New-AzApiManagement](./New-AzApiManagement.md)
9695

src/ApiManagement/ApiManagement/help/Remove-AzApiManagementRegion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Remove-AzApiManagementRegion -ApiManagement <PsApiManagement> -Location <String>
2121
## DESCRIPTION
2222
The **Remove-AzApiManagementRegion** cmdlet removes instance of type **Microsoft.Azure.Commands.ApiManagement.Models.PsApiManagementRegion** from a collection of **AdditionalRegions** of provided the instance of type **Microsoft.Azure.Commands.ApiManagement.Models.PsApiManagement**.
2323
This cmdlet does not modify deployment by itself but updates the instance of **PsApiManagement** in-memory.
24-
To update a deployment of an API Management, pass the modified **PsApiManagementInstance** to **Update-AzApiManagement**.
24+
To update a deployment of an API Management, pass the modified **PsApiManagementInstance** to **Set-AzApiManagement**.
2525

2626
## EXAMPLES
2727

@@ -34,7 +34,7 @@ This command removes the region named East US from the **PsApiManagement** insta
3434

3535
### Example 2: Remove a region from a PsApiManagement instance using a series of commands
3636
```
37-
PS C:\>Get-AzApiManagement -ResourceGroupName "Contoso" -Name ContosoApi | Remove-AzApiManagementRegion -Location "East US" | Update-AzApiManagementDeployment
37+
PS C:\>Get-AzApiManagement -ResourceGroupName "Contoso" -Name ContosoApi | Remove-AzApiManagementRegion -Location "East US" | Set-AzApiManagement
3838
```
3939

4040
This first command gets an instance of **PsApiManagement** from the resource group named Contoso named ContosoApi.

src/ApiManagement/ApiManagement/help/Update-AzApiManagementRegion.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,18 @@ Update-AzApiManagementRegion -ApiManagement <PsApiManagement> -Location <String>
2222
## DESCRIPTION
2323
The **Update-AzApiManagementRegion** cmdlet updates an existing instance of type **Microsoft.Azure.Commands.ApiManagement.Models.PsApiManagementRegion** in a collection of **AdditionalRegions** objects of a provided instance of type **Microsoft.Azure.Commands.ApiManagement.Models.PsApiManagement**.
2424
This cmdlet does not deploy anything but updates an instance of **PsApiManagement** in-memory.
25-
To update a deployment of an API Management use the modified **PsApiManagementInstance** to the Update-AzApiManagementDeployment cmdlet.
25+
To update a deployment of an API Management use the modified **PsApiManagementInstance** to the Set-AzApiManagement cmdlet.
2626

2727
## EXAMPLES
2828

2929
### Example 1: Increases capacity of Additional Region in a PsApiManagement instance
3030
```powershell
3131
PS C:\>$apimService = Get-AzApiManagement -ResourceGroupName $resourceGroupName -Name $apiManagementName
3232
PS C:\>$apimService = Update-AzApiManagementRegion -ApiManagement $apimService -Location "North Central US" -Capacity 2 -Sku Premium
33-
34-
# Set the ApiManagement service and Enable Msi idenity on the service
35-
PS C:\>$updatedService = Set-AzApiManagement -InputObject $apimService -PassThru
33+
PS C:\>$apimService = Set-AzApiManagement -InputObject $apimService -PassThru
3634
```
3735

38-
This command gets the API Management Premium SKU service, having regions in South Central US and North Central US. It then increases the Capacity of the North Central US region to 2 using the **Update-AzApiManagementRegion**. The next cmdlet Set-AzApiManagement applies the configuration change to the Api Management service.
36+
This command gets the API Management Premium SKU service, having regions in South Central US and North Central US. It then increases the Capacity of the North Central US region to 2 using the **Set-AzApiManagement**. The next cmdlet **Set-AzApiManagement** applies the configuration change to the Api Management service.
3937

4038
## PARAMETERS
4139

@@ -165,4 +163,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
165163
166164
[Remove-AzApiManagementRegion](./Remove-AzApiManagementRegion.md)
167165
168-
[Update-AzApiManagementDeployment](./Update-AzApiManagementDeployment.md)
166+
[Set-AzApiManagement](./Set-AzApiManagement.md)

src/Automation/Automation/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020
## Upcoming Release
2121
* Fixed example typo in reference documentation for `Register-AzAutomationDscNode`
22+
* Added clarification on OS restriction to Register-AzAutomationDSCNode
2223

2324
## Version 1.3.2
2425
* Fixed miscellaneous typos across module

src/Automation/Automation/help/Register-AzAutomationDscNode.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema: 2.0.0
99
# Register-AzAutomationDscNode
1010

1111
## SYNOPSIS
12-
Registers an Azure virtual machine as a DSC node for an Automation account.
12+
Registers an Azure virtual machine running Windows OS as a DSC node for an Automation account.
1313

1414
## SYNTAX
1515

@@ -22,7 +22,7 @@ Register-AzAutomationDscNode -AzureVMName <String> [-NodeConfigurationName <Stri
2222
```
2323

2424
## DESCRIPTION
25-
The **Register-AzAutomationDscNode** cmdlet registers an Azure virtual machine as an APS Desired State Configuration (DSC) node in an Azure Automation account.
25+
The **Register-AzAutomationDscNode** cmdlet registers an Azure virtual machine as an APS Desired State Configuration (DSC) node in an Azure Automation account. This cmdlet will only register VMs running Windows OS as an Automation DSC Node for an account.
2626

2727
If you need to register a node to an automation account in a different subscription,
2828
you will need to use an ARM template rather than cmdlets.

src/EventGrid/EventGrid.Test/EventGrid.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<PackageReference Include="Microsoft.Azure.Management.EventHub" Version="2.5.0" />
1616
<PackageReference Include="Microsoft.Azure.Management.Relay" Version="2.0.2" />
1717
<PackageReference Include="Microsoft.Azure.Management.ServiceBus" Version="2.1.0" />
18-
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="12.0.0" />
18+
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="13.1.0" />
1919
</ItemGroup>
2020

2121
</Project>

src/Monitor/Monitor.Test/Alerts/NewAzureRmMetricAlertRuleV2CriteriaTests.cs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,47 @@ public void NewMetricAlertRuleV2CriteriaParametersProcessing()
4747
cmdlet.TimeAggregation = "Total";
4848
cmdlet.ExecuteCmdlet();
4949

50-
Func<PSMetricCriteria, bool> verify = r =>
50+
Func<IPSMultiMetricCriteria, bool> verify = crit =>
5151
{
52+
var r = crit as PSMetricCriteria;
5253
Assert.Equal("PacketsInDDoS", r.MetricName);
5354
Assert.Equal("GreaterThan", r.OperatorProperty);
5455
Assert.Equal(2, r.Threshold);
5556
Assert.Equal("Total", r.TimeAggregation);
5657
return true;
5758
};
5859

59-
this.commandRuntimeMock.Verify(o => o.WriteObject(It.Is<PSMetricCriteria>(r => verify(r))), Times.Once);
60+
this.commandRuntimeMock.Verify(o => o.WriteObject(It.Is<IPSMultiMetricCriteria>(r => verify(r))), Times.Once);
61+
}
62+
63+
[Fact]
64+
[Trait(Category.AcceptanceType, Category.CheckIn)]
65+
public void NewDynamicMetricAlertRuleV2CriteriaParametersProcessing()
66+
{
67+
// Setting required parameter
68+
cmdlet.MetricName = "PacketsInDDoS";
69+
cmdlet.Operator = "GreaterOrLessThan";
70+
cmdlet.TimeAggregation = "Total";
71+
cmdlet.ThresholdSensitivity = "High";
72+
cmdlet.ViolationCount= 2;
73+
cmdlet.ExaminedAggregatedPointCount= 4;
74+
cmdlet.IgnoreDataBefore = new DateTime(1,1,1);
75+
cmdlet.DynamicThreshold = new SwitchParameter(true);
76+
cmdlet.ExecuteCmdlet();
77+
78+
Func<IPSMultiMetricCriteria, bool> verify = crit =>
79+
{
80+
var r = crit as PSDynamicMetricCriteria;
81+
Assert.Equal("PacketsInDDoS", r.MetricName);
82+
Assert.Equal("GreaterOrLessThan", r.OperatorProperty);
83+
Assert.Equal("Total", r.TimeAggregation);
84+
Assert.Equal("High", r.AlertSensitivity);
85+
Assert.Equal(2, r.FailingPeriods.MinFailingPeriodsToAlert);
86+
Assert.Equal(4, r.FailingPeriods.NumberOfEvaluationPeriods);
87+
return true;
88+
};
89+
90+
this.commandRuntimeMock.Verify(o => o.WriteObject(It.Is<IPSMultiMetricCriteria>(r => verify(r))), Times.Once);
6091
}
6192
}
6293
}

src/Monitor/Monitor.Test/ScenarioTests/AlertsTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,12 @@ public void TestAddAzureRmMetricAlertRuleV2()
105105
{
106106
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmMetricAlertRuleV2");
107107
}
108+
109+
[Fact]
110+
[Trait(Category.AcceptanceType, Category.CheckIn)]
111+
public void TestAddAzureRmDynamicMetricAlertRuleV2()
112+
{
113+
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmMetricAlertRuleV2-DynamicThreshold");
114+
}
108115
}
109116
}

src/Monitor/Monitor.Test/ScenarioTests/AlertsTests.ps1

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,4 +319,41 @@ function Test-AddAzureRmMetricAlertRuleV2
319319
Remove-AzureRmStorageAccount -ResourceGroupName $rgName -Name $resourceName
320320
Remove-AzResourceGroup -Name $rgname -Force
321321
}
322+
}
323+
324+
<#
325+
.SYNOPSIS
326+
Tests adding a GenV2 dyanmic metric alert rule.
327+
#>
328+
function Test-AddAzureRmMetricAlertRuleV2-DynamicThreshold
329+
{
330+
# Setup
331+
$sub = Get-AzContext
332+
$subscription = $sub.subscription.subscriptionId
333+
$rgname = Get-ResourceGroupName
334+
$location =Get-ProviderLocation ResourceManagement
335+
$resourceName = Get-ResourceName
336+
$ruleName = Get-ResourceName
337+
$actionGroupName = Get-ResourceName
338+
$targetResourceId = '/subscriptions/'+$subscription+'/resourceGroups/'+$rgname+'/providers/Microsoft.Storage/storageAccounts/'+$resourceName
339+
New-AzResourceGroup -Name $rgname -Location $location -Force
340+
New-AzStorageAccount -ResourceGroupName $rgname -Name $resourceName -Location $location -Type Standard_GRS
341+
$email = New-AzActionGroupReceiver -Name 'user1' -EmailReceiver -EmailAddress '[email protected]'
342+
$NewActionGroup = Set-AzureRmActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -Receiver $email
343+
$actionGroup = New-AzActionGroup -ActionGroupId $NewActionGroup.Id
344+
$condition = New-AzMetricAlertRuleV2Criteria -MetricName "Transactions" -Operator GreaterThan -DynamicThreshold -TimeAggregation Total -Sensitivity High
345+
try
346+
{
347+
# Test
348+
$actual = Add-AzMetricAlertRuleV2 -Name $ruleName -ResourceGroupName $rgname -WindowSize 01:00:00 -Frequency 00:05:00 -TargetResourceId $targetResourceId -Condition $condition -ActionGroup $actionGroup -Severity 3
349+
Assert-AreEqual $actual.Name $ruleName
350+
}
351+
finally
352+
{
353+
# Cleanup
354+
Remove-AzMetricAlertRuleV2 -ResourceGroupName $rgname -Name $ruleName
355+
Remove-AzActionGroup -ResourceGroupName $rgname -Name $actionGroupName
356+
Remove-AzureRmStorageAccount -ResourceGroupName $rgName -Name $resourceName
357+
Remove-AzResourceGroup -Name $rgname -Force
358+
}
322359
}

src/Monitor/Monitor.Test/ScenarioTests/ScheduledQueryRulesTests.ps1

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
function Test-setup
1717
{
1818
$global:ruleName = Get-ResourceName
19+
$global:ruleName2 = Get-ResourceName
20+
$global:ruleName3 = Get-ResourceName
1921
$global:resourceGroupName = Get-ResourceGroupName
2022
$global:location = Get-ProviderLocation("microsoft.insights")
2123
$global:description = "SQR log alert rule"
@@ -237,15 +239,14 @@ function Test-PipingRemoveSetUpdateScheduledQueryRule
237239
$retrieved = Get-AzScheduledQueryRule -ResourceGroup $resourceGroupName -Name $ruleName | Remove-AzScheduledQueryRule
238240
Assert-Null $retrieved
239241

240-
$scheduledQueryRule = New-AzScheduledQueryRule -Location $location -Name $ruleName -ResourceGroupName $resourceGroupName -Action $alertingAction -Source $source -Enabled $enabled -Description $description -Schedule $schedule -Tag $tags
241-
Verify-ScheduledQueryRule $scheduledQueryRule
242+
$scheduledQueryRule = New-AzScheduledQueryRule -Location $location -Name $ruleName2 -ResourceGroupName $resourceGroupName -Action $alertingAction -Source $source -Enabled $enabled -Description $description -Schedule $schedule -Tag $tags
242243

243244
Write-Debug " ****** Removing Scheduled Query Rule by Resource Id"
244-
$retrieved = Get-AzScheduledQueryRule -ResourceId $resourceId | Remove-AzScheduledQueryRule
245+
$retrieved = Get-AzScheduledQueryRule -ResourceId $scheduledQueryRule.Id | Remove-AzScheduledQueryRule
245246
Assert-Null $retrieved
246247

247-
$scheduledQueryRule = New-AzScheduledQueryRule -Location $location -Name $ruleName -ResourceGroupName $resourceGroupName -Action $alertingAction -Source $source -Enabled $enabled -Description $description -Schedule $schedule -Tag $tags
248-
Verify-ScheduledQueryRule $scheduledQueryRule
248+
$scheduledQueryRule = New-AzScheduledQueryRule -Location $location -Name $ruleName3 -ResourceGroupName $resourceGroupName -Action $alertingAction -Source $source -Enabled $enabled -Description $description -Schedule $schedule -Tag $tags
249+
249250
Write-Debug " ****** Removing Scheduled Query Rules in ResourceGroup"
250251
$retrieved = Get-AzScheduledQueryRule -ResourceGroupName $resourceGroupName | Remove-AzScheduledQueryRule
251252
Assert-Null $retrieved

0 commit comments

Comments
 (0)