Skip to content

Commit a97b3e9

Browse files
authored
Merge branch 'master' into patch-1
2 parents a3eb6de + dc79350 commit a97b3e9

File tree

13 files changed

+95
-47
lines changed

13 files changed

+95
-47
lines changed

src/ApiManagement/ApiManagement/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Update `-Format` parameter description in `Set-AzApiManagementPolicy` reference documentation
2122

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

src/ApiManagement/ApiManagement/help/Set-AzApiManagementPolicy.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ Accept wildcard characters: False
142142
```
143143
144144
### -Format
145-
Specifies the format of the policy. When using `application/vnd.ms-az-apim.policy+xml`,
146-
expressions contained within the policy must be XML-escaped. When using `application/vnd.ms-az-apim.policy.raw+xml` it
145+
Specifies the format of the policy. When using `application/vnd.ms-azure-apim.policy+xml`,
146+
expressions contained within the policy must be XML-escaped. When using `application/vnd.ms-azure-apim.policy.raw+xml` it
147147
is **not** necessary for the policy to be XML-escaped.
148-
The default value is `application/vnd.ms-az-apim.policy+xml`.
148+
The default value is `application/vnd.ms-azure-apim.policy+xml`.
149149
This parameter is optional.
150150

151151
```yaml

src/Blueprint/Blueprint/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Add functionality to make sure Blueprint RP is registered before any service calls
2122

2223
## Version 0.2.4
2324
* Fixed miscellaneous typos across module

src/Blueprint/Blueprint/Cmdlets/BlueprintCmdletBase.cs

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
using Microsoft.Azure.Commands.ResourceManager.Common;
1919
using Microsoft.Azure.Management.Authorization.Version2015_07_01;
2020
using Microsoft.Azure.Management.Internal.ResourceManager.Version2018_05_01;
21-
using Microsoft.Azure.PowerShell.Cmdlets.Blueprint.Properties;
2221
using Microsoft.Rest;
2322
using System;
24-
using System.Collections.Generic;
2523
using System.IO;
24+
using Microsoft.Azure.Management.Internal.Resources.Models;
25+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
26+
using Provider = Microsoft.Azure.Management.Internal.ResourceManager.Version2018_05_01.Models.Provider;
2627

2728
namespace Microsoft.Azure.Commands.Blueprint.Cmdlets
2829
{
@@ -121,15 +122,41 @@ protected override void WriteExceptionError(Exception ex)
121122
/// <param name="subscriptionId"> SubscriptionId passed from the cmdlet</param>
122123
protected void RegisterBlueprintRp(string subscriptionId)
123124
{
125+
// To save time, we'll check the registration state first before making the register call.
124126
ResourceManagerClient.SubscriptionId = subscriptionId;
125-
var response = ResourceManagerClient.Providers.Register(BlueprintConstants.BlueprintProviderNamespace);
127+
Provider provider = ResourceManagerClient.Providers.Get(BlueprintConstants.BlueprintProviderNamespace);
126128

127-
if (response == null)
129+
if (provider.RegistrationState == RegistrationState.Registered)
128130
{
129-
throw new KeyNotFoundException(string.Format(Resources.ResourceProviderRegistrationFailed, BlueprintConstants.BlueprintProviderNamespace));
131+
return;
130132
}
131-
}
132133

134+
// The reason we poll for the registrationState for RP registration is because we'd like to make sure the RP registering
135+
// happens before the blueprint creation/assignment request is submitted. This should help alleviate the spike in
136+
// blueprint creation/assignment failures due to RP not being registered.
137+
const int MaxPoll = 20;
138+
int pollCount = 0;
139+
140+
do
141+
{
142+
if (pollCount > MaxPoll)
143+
{
144+
// We should ideally throw a timeout exception here but we're collecting logs on service side about RP registration failures
145+
// and would like to continue with blueprint/assignment creation flow.
146+
//
147+
// To-Do: Add TimeoutException
148+
break;
149+
}
150+
151+
provider = ResourceManagerClient.Providers.Register(BlueprintConstants
152+
.BlueprintProviderNamespace); // Instead of Get, do Register call again since GET takes its sweet time to return the status.
153+
154+
TestMockSupport.Delay(TimeSpan.FromSeconds(1));
155+
156+
pollCount++;
157+
158+
} while (provider.RegistrationState != RegistrationState.Registered);
159+
}
133160

134161
/// <summary>
135162
/// Expects a string that consist of full file path with file extension and check if it exists.

src/HealthcareApis/HealthcareApis.Test/ScenarioTests/HealthcareApisServiceTests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function Test-AzRmHealthcareApisService{
4747
# Assert
4848
Assert-AreEqual $actual.Name $rname
4949
Assert-AreEqual $actual.Properties.CosmosDbConfiguration.OfferThroughput $offerThroughput
50+
Assert-AreEqual $actual.Kind $kind
5051
#Update using parameters
5152
$newOfferThroughput = $offerThroughput - 600
5253
$updated = Set-AzHealthcareApisService -ResourceId $actual.Id -CosmosOfferThroughput $newOfferThroughput;

0 commit comments

Comments
 (0)