Reputation: 323
Currently we use boto (python library) to deploy infrastructure as code using AWS services. In my current project I am trying to create infrastructure as code for Azure, but I would like to stick with python to generate this code.
do we have any python libraries to invoke Azure APIs to setup infrastructure. or create json templates to deploy on azure.
Upvotes: 0
Views: 4635
Reputation: 97
If anyone stumbles over this in 2023 then I would suggest Pulumi as a cross language and cross platform IaC (Infrastructure as Code) tool. I have used it myself to write in C# and Python. https://www.pulumi.com/docs/get-started/
Upvotes: 0
Reputation: 24148
About how to create custom templates for Azure resource management, you can refer to the document https://azure.microsoft.com/en-us/documentation/articles/resource-group-authoring-templates/ to know the template structure & format.
The basic structure of a template as below:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "",
"parameters": { ... },
"variables": { ... },
"resources": [ ... ],
"outputs": { ... }
}
And you can access the schema url of deployment template (https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json) to get the metadata definition of template.
Upvotes: 0
Reputation: 1105
There is a python SDK (in preview) that allows to work with Azure Resource Manager to create resource groups, VMs...
You'll find the documentation here : http://azure-sdk-for-python.readthedocs.org/en/latest/resourcemanagement.html
The SDK is hosted on GitHub : https://github.com/azure/azure-sdk-for-python
Another solution could be to use Azure Resource Management REST APIs directly. These APIs are documented here: https://msdn.microsoft.com/en-us/library/azure/dn790568.aspx
Hope this helps
Julien
Upvotes: 4