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
function Add-NewPolicy { | |
param ($ApiMgmtContext, $product, $addPolicyToProduct, $policy, $apiId) | |
Write-Host "**************************** Add-NewPolicy *******************************" | |
Write-Host "[POLICY] Policy name :: $($policy.path)" | |
Get-Location | |
$policies = (Get-ChildItem ../**/**.* -Recurse -filter $policy.path) |
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
{ | |
"apimInput": [ | |
{ | |
"id": "your product id", | |
"title": "product title", | |
"description": "product description", | |
"product_legal_terms": "product legal term and condition leave it blank", | |
"subscription_requires": true, | |
"apis": [ | |
{ |
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
################################### FIND API ################################ | |
function Get-API { | |
param ($ApiMgmtContext, $api) | |
Write-Host "[FIND API] Searching for Api :: '$($api.name)' ..." -ForegroundColor Green | |
$getApimApiParams = @{ | |
Context =$ApiMgmtContext | |
ApiId =$api.api_name | |
} |
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
################################### Method to Add Product to Group 'Add-ProductToGroup' ################################ | |
function Add-ProductToGroup { | |
param ($ApiMgmtContext, $product, $groupName) | |
Write-Host "**************************** Add-ProductToGroup *******************************" | |
Write-Host "[LINK-PRODUCT-TO-PRODUCT-GROUP] Working on Adding product to Product group :: '$($product.id)' to '$($groupName)' group..." | |
$getApimGroupParams = @{ | |
Context =$ApiMgmtContext | |
ProductId =$product.product_id | |
Name = $groupName |
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
################################### Method to Add New product ################################ | |
function Add-NewAPIMProduct { | |
param ($ApiMgmtContext, $product) | |
Write-Host "**************************** Add-NewAPIMProduct *******************************" | |
$getApimProductParams = @{ | |
Context =$ApiMgmtContext | |
ProductId =$product.id |
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
################################### Method to New API Version ################################ | |
function Add-NewApiVersion { | |
param($ApiMgmtContext,$apiName,$displayName, $apiVersion, $path,$apiSpecificationPath,$serviceUrl, $revision) | |
$versionSetLookup = Get-AzApiManagementApiVersionSet -Context $ApiMgmtContext | Where-Object { $_.DisplayName -eq "$apiName" } | Sort-Object -Property ApiVersionSetId -Descending | Select-Object -first 1 | |
if($versionSetLookup -eq $null) | |
{ | |
$newApimApiVersionSetParams = @{ | |
Context = $ApiMgmtContext |
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
################################### Method to Add Product to Group 'Add-ProductToGroup' ################################ | |
function Add-NewAPI { | |
param ($ApiMgmtContext, $product, $api) | |
Write-Host "**************************** Add-NewAPI*******************************" | |
# Powershell returns API name value in API_Id field | |
$reverionSchemaFiles = (Get-ChildItem ../**/**.* -Recurse -filter $api.api_path) | |
if($reverionSchemaFiles.Count -gt 0) | |
{ |
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
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory = $true)] | |
[string]$resource_group_name = "your-resource_group-name", | |
[string]$apim_name = "apim-name" | |
) | |
$SpecificationFormat="OpenApi" | |
$apiProtocols = @('https') | |
$publishedState ="Published" |