APIM ARM template creation - ibm-api-management

I have an APIM instance and API's working on it. I want to create ARM template for deployment but can't understand how to do it. I only have the Azure portal repository for it and don't want to create a VSO repository. I am new to ARM templates, so don't have much information.

You can put all your code like the arm templates or swagger files wherever you want, GitHub, Azure DevOps, locally only ... and then deploy your api using Api-M's REST interface (https://learn.microsoft.com/en-us/rest/api/apimanagement/api/createorupdate), the PowerShell AzureRm or Az module https://learn.microsoft.com/en-us/powershell/module/azurerm.apimanagement/import-azurermapimanagementapi?view=azurermps-6.13.0 or by deploying an arm template.
When it comes to creating arm templates you may take a look here:
https://github.com/Azure/azure-quickstart-templates/blob/master/101-azure-api-management-create/azuredeploy.json
Anyway, we first started with arm templates as well and found later out that it's easier to use the REST interface or the PowerShell module by deploying a swagger file and the policies.

Related

Provisioning and Configuration - Azure cloud

For provisioning AWS services(EC2/R53/VPC/S3/..), technology like Terraform have unreliable approach in terms of performing rollback, error handling etc.
AWS CloudFormation templates address these problems.
CloudFormation templates are used for both provisioning of aws services(like EC2/VPC/r53/S3/...) and configuration of every service.
Additionally this template approach should easily fit into scripted pipeline using Jenkins.
What is the approach for provisioning and configuration of services in Azure cloud?
Its called Azure Resource Manager (Peter gave a helpful link in the comments). You will interact with ARM through Azure powershell, Azure Cli, ARM Templates, different SDK's or just plain rest calls to create resources.
ARM Templates are the closest thing you can get to CloudFormation templates, but they dont really have all the features of CloudFormation templates.
For example, there is no preview of the changes that will happen before you run the template. some services can not be configured with ARM Templates (or some of the properties cannot be configured).

How to deploy Azure Function app including code using ARM template from Azure marketplace

I want to deploy a Function App including code using an ARM template that is going to be published in the Azure Marketplace as a Managed App.
I've seen in the docs that you can add a sourcecontrols element in the ARM template that you can use to point to e.g. a GitHub repository. However, I don't want to use a repository, I want to code to be uploaded to the Function App.
I also know you can upload the code using the Azure CLI or powershell, however this will not be possible when publishing the app in the marketplace.
Is there a way to have a package that contains everything including the code and have that uploaded to the Function App all using an ARM template in the Azure Marketplace?
You should take a look at Run-From-Zip. Basically, you host the zip package somewhere (typically storage blob), and in ARM template you just set a WEBSITE_RUN_FROM_ZIP App Setting pointing to it.
As an alternative, you could use the ARM msdeploy extension, and point it to the zip package (e.g. something like this).

Enterprise standards for deploying the ARM templates along with source code in to azure environment using VSTS?

I working on Azure ARM templates, I developed few ARM templates for production environment it includes vnet, subnet, web app, API app, storage and database etc...
I had the source code contains the MVC application and Azure API Application and check in the code into VSTS team repository.
Source code managed in VS2017:
Currently I created Build and Release for source code along with ARM templates in single build and release by following this link.
I have few questions in my mind after implemented above process in my current environment:
What are best industry practices to manage the source code and ARM templates in VS2017?
How to know which version of ARM template deployed in specified resource group?
For suppose if someone changes the application code only, then also ARM template deployed along with modified source code into azure. is it recommended approach?
Is it recommended approach for deploying the source code along with ARM templates at time by creating single build and release definition In VSTS?
Is it recommended way to give application settings and connection strings in web app and API app arm templates?
What is the enterprise implementations to deploy the ARM templates and source code into azure environment using VSTS?
You can deploy ARM and web application in the same build/release, simple workflow:
Check the template file has been updated or not through VSTS REST API (e.g. Get a single commit with changed items)
Check the related resource is existing in Azure through Azure PowerShell task (e.g. Find-AzureRmResource, Get-AzureRmResource)
Add a new variable per to the results of step1 and step3 through Logging Command (e.g. isUpdated: Write-Host "##vso[task.setvariable variable= isUpdated;]true")
Add Azure Resource Group Deployment task and choose custom conditions in Run this taks box (Custom condition: eq(variables[isUpdated '], 'true')
Add corresponding tasks to deploy your web app.

Deploying Azure Function Swagger API Definition using ARM

We are creating an ARM template for our Azure Function that we would like to use for deploying to different environments however we cannot figure out how to deploy the Swagger with it.
As far as we see in the ARM template there is an option to add a link to the Swagger but can the Swagger be deployed as part of the ARM template itself?

Is there a way to deploy a VSTS project in an app service using an ARM template?

I'm creating resources on Azure using an ARM template. I have three web apps to deploy. Normally i can deploy them separately using VSTS which is slow. So is there a way to deploy a project on VSTS using an ARM template?
You can deploy a template that uses web deploy to also deploy a web app - you can deploy to slots or deploy to an existing web app (not defined in your ARM template). This sample has an MSDeploy extension that does the work.
https://github.com/Azure/azure-quickstart-templates/tree/master/201-web-app-blob-connection
You can also go this route:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-get-started/
Both can be done via VSTS...
You would need to export ARM template from your azure RM portal.
Make sure
you have single resource group where all these apps have been deployed (since you want to deploy them together).
Export the resource management template and attach to your VSTS project as resource.
Add a new release task in your VSTS as Azure Resource Group Deployment.
Add connection details to your resource group.
Specify the previously exported template
Configure the parameters (or use variables).
you should be able to use VSTS build and release management to deploy ARM resources.

Resources