1

I've been using the Microsoft.Azure.Management.Fluent packages to create a tool that will build out my environment and do some additional setup. Now, I need to add an API Management instance. I don't see anything related to API Management in the Fluent SDK. I'm assuming there's no SDK wrapper for it and I just need to make the REST calls myself. I'm looking for a guide.

2 Answers 2

3

Currently, API Management is not supported in the Fluent api. Here is an issue about this.

Instead, there is another package Microsoft.Azure.Management.ApiManagement 6.0.0-preview, you can use it to create API Management instance. The code like below:

 // you should provide the real credentialhere. ApiManagementClient client = new ApiManagementClient(the_credential); //provide the neccesary parameters to create the APIM instance. client.ApiManagementService.CreateOrUpdate(the_parameters); 

Another way to create API Management is by using this api: Api Management Service - Create Or Update. You can read the api doc for its usage and examples.

Sign up to request clarification or add additional context in comments.

1 Comment

The preview package is nice. I'm converting to this as it simplifies a bunch of configuration that I need to do after the API manager is created. Thanks for that.
1

You can do it with REST:
Deployments - Create Or Update

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}?api-version=2020-06-01 

You have to pass the link to your ARM Template in the Request-Body:

{ "properties": { "templateLink": { "uri": "https://example.com/exampleTemplate.json" }, "parameters": {}, "mode": "Complete", "onErrorDeployment": { "type": "SpecificDeployment", "deploymentName": "name-of-deployment-to-use" } } } 

You can store the ARM Template in Blob Storage and reference it in the Body.

Please find a sample API-Management ARM Template on GitHub - azure-quickstart-templates

1 Comment

Thanks, yes this worked for me using the IAzure.Deployments fluent API to run the ARM template, but I now have the problem of not being able to check for existence, so I may have to go REST with the ARM template in blob storage.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.