Created
April 3, 2020 06:24
-
-
Save gsscoder/7bde38b8a2fbbd80add148d1058f2ca9 to your computer and use it in GitHub Desktop.
Attempt to create APIM with New-AzResource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code actually doesn't work. | |
$secret = 'B=EBh3glTf523Xj@uLGO]o@kSteLoC@O' | |
$group = 'INTRANETAI-Europe-DEV' | |
$service = 'intranetai-europe-test-dev' | |
$context = New-AzApiManagementContext -ResourceGroupName $group -ServiceName $service | |
$versionSet = New-AzApiManagementApiVersionSet -Context $context -Name 'news' ` | |
-Scheme Header -HeaderName 'x-api-version' ` | |
-Description 'version by x-api-version' | |
$id = $versionSet.Id -replace 'apiVersionSets', 'api-version-sets' | |
$props = @{ | |
"name" = 'news/ver1' | |
"serviceUrl" = $null | |
"path" = 'SampleFunc' | |
"protocols" = @("https") | |
"apiVersionSetId" = $id | |
"apiVersion" = 'v1' | |
} | |
New-AzResource -PropertyObject $props -ResourceGroupName $group ` | |
-ResourceType Microsoft.ApiManagement/service/apis ` | |
-ResourceName "$service/news/ver1" ` | |
-ApiVersion 2018-01-01 -Force | |
$props = @{ | |
"name" = 'news/ver2' | |
"serviceUrl" = $null | |
"path" = 'SampleFunc' | |
"protocols" = @("https") | |
"apiVersionSetId" = $id | |
"apiVersion" = 'v2' | |
} | |
New-AzResource -PropertyObject $props -ResourceGroupName $group ` | |
-ResourceType Microsoft.ApiManagement/service/apis ` | |
-ResourceName "$service/news/ver2" ` | |
-ApiVersion 2018-01-01 -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment