We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
Manages an API Schema within an API Management Service.
Example Usage
using System.IO;
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleApi = Output.Create(Azure.ApiManagement.GetApi.InvokeAsync(new Azure.ApiManagement.GetApiArgs
{
Name = "search-api",
ApiManagementName = "search-api-management",
ResourceGroupName = "search-service",
Revision = "2",
}));
var exampleApiSchema = new Azure.ApiManagement.ApiSchema("exampleApiSchema", new Azure.ApiManagement.ApiSchemaArgs
{
ApiName = exampleApi.Apply(exampleApi => exampleApi.Name),
ApiManagementName = exampleApi.Apply(exampleApi => exampleApi.ApiManagementName),
ResourceGroupName = exampleApi.Apply(exampleApi => exampleApi.ResourceGroupName),
SchemaId = "example-schema",
ContentType = "application/vnd.ms-azure-apim.xsd+xml",
Value = File.ReadAllText("api_management_api_schema.xml"),
});
}
}
package main
import (
"io/ioutil"
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/apimanagement"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func readFileOrPanic(path string) pulumi.StringPtrInput {
data, err := ioutil.ReadFile(path)
if err != nil {
panic(err.Error())
}
return pulumi.String(string(data))
}
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleApi, err := apimanagement.LookupApi(ctx, &apimanagement.LookupApiArgs{
Name: "search-api",
ApiManagementName: "search-api-management",
ResourceGroupName: "search-service",
Revision: "2",
}, nil)
if err != nil {
return err
}
_, err = apimanagement.NewApiSchema(ctx, "exampleApiSchema", &apimanagement.ApiSchemaArgs{
ApiName: pulumi.String(exampleApi.Name),
ApiManagementName: pulumi.String(exampleApi.ApiManagementName),
ResourceGroupName: pulumi.String(exampleApi.ResourceGroupName),
SchemaId: pulumi.String("example-schema"),
ContentType: pulumi.String("application/vnd.ms-azure-apim.xsd+xml"),
Value: readFileOrPanic("api_management_api_schema.xml"),
})
if err != nil {
return err
}
return nil
})
}
Example coming soon!
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * from "fs";
const exampleApi = azure.apimanagement.getApi({
name: "search-api",
apiManagementName: "search-api-management",
resourceGroupName: "search-service",
revision: "2",
});
const exampleApiSchema = new azure.apimanagement.ApiSchema("exampleApiSchema", {
apiName: exampleApi.then(exampleApi => exampleApi.name),
apiManagementName: exampleApi.then(exampleApi => exampleApi.apiManagementName),
resourceGroupName: exampleApi.then(exampleApi => exampleApi.resourceGroupName),
schemaId: "example-schema",
contentType: "application/vnd.ms-azure-apim.xsd+xml",
value: fs.readFileSync("api_management_api_schema.xml"),
});
import pulumi
import pulumi_azure as azure
example_api = azure.apimanagement.get_api(name="search-api",
api_management_name="search-api-management",
resource_group_name="search-service",
revision="2")
example_api_schema = azure.apimanagement.ApiSchema("exampleApiSchema",
api_name=example_api.name,
api_management_name=example_api.api_management_name,
resource_group_name=example_api.resource_group_name,
schema_id="example-schema",
content_type="application/vnd.ms-azure-apim.xsd+xml",
value=(lambda path: open(path).read())("api_management_api_schema.xml"))
Example coming soon!
Create ApiSchema Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApiSchema(name: string, args: ApiSchemaArgs, opts?: CustomResourceOptions);@overload
def ApiSchema(resource_name: str,
args: ApiSchemaArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ApiSchema(resource_name: str,
opts: Optional[ResourceOptions] = None,
api_management_name: Optional[str] = None,
api_name: Optional[str] = None,
content_type: Optional[str] = None,
resource_group_name: Optional[str] = None,
schema_id: Optional[str] = None,
value: Optional[str] = None)func NewApiSchema(ctx *Context, name string, args ApiSchemaArgs, opts ...ResourceOption) (*ApiSchema, error)public ApiSchema(string name, ApiSchemaArgs args, CustomResourceOptions? opts = null)
public ApiSchema(String name, ApiSchemaArgs args)
public ApiSchema(String name, ApiSchemaArgs args, CustomResourceOptions options)
type: azure:apimanagement:ApiSchema
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ApiSchemaArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ApiSchemaArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ApiSchemaArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiSchemaArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApiSchemaArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var apiSchemaResource = new Azure.ApiManagement.ApiSchema("apiSchemaResource", new()
{
ApiManagementName = "string",
ApiName = "string",
ContentType = "string",
ResourceGroupName = "string",
SchemaId = "string",
Value = "string",
});
example, err := apimanagement.NewApiSchema(ctx, "apiSchemaResource", &apimanagement.ApiSchemaArgs{
ApiManagementName: pulumi.String("string"),
ApiName: pulumi.String("string"),
ContentType: pulumi.String("string"),
ResourceGroupName: pulumi.String("string"),
SchemaId: pulumi.String("string"),
Value: pulumi.String("string"),
})
var apiSchemaResource = new ApiSchema("apiSchemaResource", ApiSchemaArgs.builder()
.apiManagementName("string")
.apiName("string")
.contentType("string")
.resourceGroupName("string")
.schemaId("string")
.value("string")
.build());
api_schema_resource = azure.apimanagement.ApiSchema("apiSchemaResource",
api_management_name="string",
api_name="string",
content_type="string",
resource_group_name="string",
schema_id="string",
value="string")
const apiSchemaResource = new azure.apimanagement.ApiSchema("apiSchemaResource", {
apiManagementName: "string",
apiName: "string",
contentType: "string",
resourceGroupName: "string",
schemaId: "string",
value: "string",
});
type: azure:apimanagement:ApiSchema
properties:
apiManagementName: string
apiName: string
contentType: string
resourceGroupName: string
schemaId: string
value: string
ApiSchema Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ApiSchema resource accepts the following input properties:
- Api
Management stringName - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- Api
Name string - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- Content
Type string - The content type of the API Schema.
- Resource
Group stringName - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- Schema
Id string - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- Value string
- The JSON escaped string defining the document representing the Schema.
- Api
Management stringName - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- Api
Name string - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- Content
Type string - The content type of the API Schema.
- Resource
Group stringName - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- Schema
Id string - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- Value string
- The JSON escaped string defining the document representing the Schema.
- api
Management StringName - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name String - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- content
Type String - The content type of the API Schema.
- resource
Group StringName - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id String - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- value String
- The JSON escaped string defining the document representing the Schema.
- api
Management stringName - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name string - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- content
Type string - The content type of the API Schema.
- resource
Group stringName - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id string - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- value string
- The JSON escaped string defining the document representing the Schema.
- api_
management_ strname - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api_
name str - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- content_
type str - The content type of the API Schema.
- resource_
group_ strname - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema_
id str - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- value str
- The JSON escaped string defining the document representing the Schema.
- api
Management StringName - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name String - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- content
Type String - The content type of the API Schema.
- resource
Group StringName - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id String - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- value String
- The JSON escaped string defining the document representing the Schema.
Outputs
All input properties are implicitly available as output properties. Additionally, the ApiSchema resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing ApiSchema Resource
Get an existing ApiSchema resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ApiSchemaState, opts?: CustomResourceOptions): ApiSchema@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
api_management_name: Optional[str] = None,
api_name: Optional[str] = None,
content_type: Optional[str] = None,
resource_group_name: Optional[str] = None,
schema_id: Optional[str] = None,
value: Optional[str] = None) -> ApiSchemafunc GetApiSchema(ctx *Context, name string, id IDInput, state *ApiSchemaState, opts ...ResourceOption) (*ApiSchema, error)public static ApiSchema Get(string name, Input<string> id, ApiSchemaState? state, CustomResourceOptions? opts = null)public static ApiSchema get(String name, Output<String> id, ApiSchemaState state, CustomResourceOptions options)resources: _: type: azure:apimanagement:ApiSchema get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Api
Management stringName - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- Api
Name string - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- Content
Type string - The content type of the API Schema.
- Resource
Group stringName - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- Schema
Id string - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- Value string
- The JSON escaped string defining the document representing the Schema.
- Api
Management stringName - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- Api
Name string - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- Content
Type string - The content type of the API Schema.
- Resource
Group stringName - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- Schema
Id string - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- Value string
- The JSON escaped string defining the document representing the Schema.
- api
Management StringName - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name String - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- content
Type String - The content type of the API Schema.
- resource
Group StringName - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id String - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- value String
- The JSON escaped string defining the document representing the Schema.
- api
Management stringName - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name string - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- content
Type string - The content type of the API Schema.
- resource
Group stringName - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id string - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- value string
- The JSON escaped string defining the document representing the Schema.
- api_
management_ strname - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api_
name str - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- content_
type str - The content type of the API Schema.
- resource_
group_ strname - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema_
id str - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- value str
- The JSON escaped string defining the document representing the Schema.
- api
Management StringName - The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
- api
Name String - The name of the API within the API Management Service where this API Schema should be created. Changing this forces a new resource to be created.
- content
Type String - The content type of the API Schema.
- resource
Group StringName - The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- schema
Id String - A unique identifier for this API Schema. Changing this forces a new resource to be created.
- value String
- The JSON escaped string defining the document representing the Schema.
Import
API Management API Schema’s can be imported using the resource id, e.g.
$ pulumi import azure:apimanagement/apiSchema:ApiSchema example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/apis/api1/schemas/schema1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
