Skip to content

Commit ddffabe

Browse files
authored
Merge branch 'master' into update-common-packages
2 parents 4697baf + 0c69820 commit ddffabe

File tree

73 files changed

+21329
-5340
lines changed

Some content is hidden

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

73 files changed

+21329
-5340
lines changed

src/Accounts/Accounts/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 common packages to include new PolicyInsights library
22+
* Fix bug where incorrect endpoint was being used in some cases for data plane cmdlets in Windows PowerShell
2223

2324
## Version 1.5.3
2425
* Fix bug with incorrect URL being used in some cases for Functions calls

src/Accounts/Authenticators/InteractiveUserAuthenticator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public async override Task<IAccessToken> Authenticate(IAzureAccount account, IAz
3030
{
3131
var auth = new AuthenticationContext(AuthenticationHelpers.GetAuthority(environment, tenant), environment?.OnPremise ?? true, tokenCache as TokenCache ?? TokenCache.DefaultShared);
3232
var response = await auth.AcquireTokenAsync(
33-
environment.ActiveDirectoryServiceEndpointResourceId,
33+
environment.GetEndpoint(resourceId),
3434
AuthenticationHelpers.PowerShellClientId,
3535
new Uri(AuthenticationHelpers.PowerShellRedirectUri),
3636
new PlatformParameters(AuthenticationHelpers.GetPromptBehavior(promptBehavior), new ConsoleParentWindow()),

src/ApiManagement/ApiManagement.ServiceManagement.Test/ScenarioTests/ApiManagementTests.ps1

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,58 @@ function SubscriptionOldModel-CrudTest {
11301130
Assert-AreEqual $patchedSk $sub.SecondaryKey
11311131
Assert-AreEqual $newSubscriptionState $sub.State
11321132
Assert-AreEqual $patchedExpirationDate $sub.ExpirationDate
1133+
1134+
# Get subscriptions by product id
1135+
$productSubs = Get-AzApiManagementSubscription -Context $context -ProductId $subs[0].ProductId
1136+
1137+
Assert-AreEqual 2 $productSubs.Count
1138+
for ($i = 0; $i -lt $productSubs.Count; $i++)
1139+
{
1140+
Assert-NotNull $productSubs[$i]
1141+
Assert-NotNull $productSubs[$i].SubscriptionId
1142+
Assert-NotNull $productSubs[$i].Scope
1143+
Assert-NotNull $productSubs[$i].State
1144+
Assert-NotNull $productSubs[$i].CreatedDate
1145+
Assert-NotNull $productSubs[$i].PrimaryKey
1146+
Assert-NotNull $productSubs[$i].SecondaryKey
1147+
1148+
Assert-AreEqual $subs[0].ProductId $productSubs[$i].ProductId
1149+
}
1150+
1151+
# Get subscriptions by user id
1152+
$userSubs = Get-AzApiManagementSubscription -Context $context -UserId $subs[0].UserId
1153+
1154+
Assert-AreEqual 3 $userSubs.Count
1155+
for ($i = 0; $i -lt $userSubs.Count; $i++)
1156+
{
1157+
Assert-NotNull $userSubs[$i]
1158+
Assert-NotNull $userSubs[$i].SubscriptionId
1159+
Assert-NotNull $userSubs[$i].Scope
1160+
Assert-NotNull $userSubs[$i].State
1161+
Assert-NotNull $userSubs[$i].CreatedDate
1162+
Assert-NotNull $userSubs[$i].PrimaryKey
1163+
Assert-NotNull $userSubs[$i].SecondaryKey
1164+
1165+
Assert-AreEqual $subs[0].UserId $userSubs[$i].UserId
1166+
}
1167+
1168+
# get Subscriptions by User and Product
1169+
$productUserSubs = Get-AzApiManagementSubscription -Context $context -UserId $subs[0].UserId -ProductId $subs[0].ProductId
1170+
1171+
Assert-AreEqual 2 $productUserSubs.Count
1172+
for ($i = 0; $i -lt $productUserSubs.Count; $i++)
1173+
{
1174+
Assert-NotNull $productUserSubs[$i]
1175+
Assert-NotNull $productUserSubs[$i].SubscriptionId
1176+
Assert-NotNull $productUserSubs[$i].Scope
1177+
Assert-NotNull $productUserSubs[$i].State
1178+
Assert-NotNull $productUserSubs[$i].CreatedDate
1179+
Assert-NotNull $productUserSubs[$i].PrimaryKey
1180+
Assert-NotNull $productUserSubs[$i].SecondaryKey
1181+
1182+
Assert-AreEqual $subs[0].UserId $productUserSubs[$i].UserId
1183+
Assert-AreEqual $subs[0].ProductId $productUserSubs[$i].ProductId
1184+
}
11331185
}
11341186
finally {
11351187
# remove created subscription
@@ -1221,6 +1273,18 @@ function SubscriptionNewModel-CrudTest {
12211273
Assert-AreEqual 1 $sub.UserId
12221274
Assert-NotNull $sub.OwnerId
12231275

1276+
# get subscription by apiId
1277+
$sub = Get-AzApiManagementSubscription -Context $context -Scope $allApisScope
1278+
1279+
Assert-AreEqual $newSubscriptionId $sub.SubscriptionId
1280+
Assert-AreEqual $patchedName $sub.Name
1281+
Assert-AreEqual $patchedPk $sub.PrimaryKey
1282+
Assert-AreEqual $patchedSk $sub.SecondaryKey
1283+
Assert-AreEqual $newSubscriptionState $sub.State
1284+
Assert-AreEqual $patchedExpirationDate $sub.ExpirationDate
1285+
Assert-NotNull $sub.UserId
1286+
Assert-AreEqual 1 $sub.UserId
1287+
Assert-NotNull $sub.OwnerId
12241288
}
12251289
finally {
12261290
# remove created subscription
@@ -2886,7 +2950,8 @@ function ApiVersionSet-CrudTest {
28862950
# there should be no API Version sets initially
28872951
Assert-AreEqual 0 $apiversionsets.Count
28882952

2889-
# create new api
2953+
# create new api and apiVersionSet
2954+
$swaggerApiId1 = getAssetName
28902955
$newApiVersionSetId = getAssetName
28912956
try {
28922957
$newVersionSetName = getAssetName
@@ -2921,8 +2986,24 @@ function ApiVersionSet-CrudTest {
29212986
Assert-AreEqual $description $newApiVersionSet.Description
29222987
Assert-AreEqual Header $newApiVersionSet.VersioningScheme
29232988
Assert-AreEqual $versionHeaderName $newApiVersionSet.VersionHeaderName
2989+
2990+
# now import an api into the ApiVersionSet
2991+
$swaggerPath = Join-Path (Join-Path "$TestOutputRoot" "Resources") "SwaggerPetStoreV2.json"
2992+
$path1 = "swaggerapifromFile"
2993+
$apiVersion = "2"
2994+
2995+
$api = Import-AzApiManagementApi -Context $context -ApiId $swaggerApiId1 -SpecificationPath $swaggerPath -SpecificationFormat Swagger -Path $path1 -ApiVersion $apiVersion -ApiVersionSetId $newApiVersionSetId
2996+
Assert-NotNull $api
2997+
Assert-AreEqual $apiVersion $api.ApiVersion
2998+
Assert-AreEqual $swaggerApiId1 $api.ApiId
2999+
Assert-AreEqual $path1 $api.Path
3000+
Assert-AreEqual $newApiVersionSet.Id $api.ApiVersionSetId
29243001
}
29253002
finally {
3003+
# remove created api
3004+
$removed = Remove-AzApiManagementApi -Context $context -ApiId $swaggerApiId1 -PassThru
3005+
Assert-True { $removed }
3006+
29263007
# remove created api version set
29273008
$removed = Remove-AzApiManagementApiVersionSet -Context $context -ApiVersionSetId $newApiVersionSetId -PassThru
29283009
Assert-True { $removed }

0 commit comments

Comments
 (0)