1. Packages
  2. Azure Classic
  3. API Docs
  4. apimanagement
  5. GlobalSchema

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.apimanagement.GlobalSchema

Explore with Pulumi AI

Manages a Global Schema within an API Management Service.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as std from "@pulumi/std";

const example = new azure.core.ResourceGroup("example", {
    name: "example-rg",
    location: "West Europe",
});
const exampleService = new azure.apimanagement.Service("example", {
    name: "example-apim",
    location: example.location,
    resourceGroupName: example.name,
    publisherName: "pub1",
    publisherEmail: "pub1@email.com",
    skuName: "Consumption_0",
});
const exampleGlobalSchema = new azure.apimanagement.GlobalSchema("example", {
    schemaId: "example-schema1",
    apiManagementName: exampleService.name,
    resourceGroupName: example.name,
    type: "xml",
    value: std.file({
        input: "api_management_api_schema.xml",
    }).then(invoke => invoke.result),
});
Copy
import pulumi
import pulumi_azure as azure
import pulumi_std as std

example = azure.core.ResourceGroup("example",
    name="example-rg",
    location="West Europe")
example_service = azure.apimanagement.Service("example",
    name="example-apim",
    location=example.location,
    resource_group_name=example.name,
    publisher_name="pub1",
    publisher_email="pub1@email.com",
    sku_name="Consumption_0")
example_global_schema = azure.apimanagement.GlobalSchema("example",
    schema_id="example-schema1",
    api_management_name=example_service.name,
    resource_group_name=example.name,
    type="xml",
    value=std.file(input="api_management_api_schema.xml").result)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/apimanagement"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-std/sdk/go/std"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("example-rg"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleService, err := apimanagement.NewService(ctx, "example", &apimanagement.ServiceArgs{
			Name:              pulumi.String("example-apim"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			PublisherName:     pulumi.String("pub1"),
			PublisherEmail:    pulumi.String("pub1@email.com"),
			SkuName:           pulumi.String("Consumption_0"),
		})
		if err != nil {
			return err
		}
		invokeFile, err := std.File(ctx, &std.FileArgs{
			Input: "api_management_api_schema.xml",
		}, nil)
		if err != nil {
			return err
		}
		_, err = apimanagement.NewGlobalSchema(ctx, "example", &apimanagement.GlobalSchemaArgs{
			SchemaId:          pulumi.String("example-schema1"),
			ApiManagementName: exampleService.Name,
			ResourceGroupName: example.Name,
			Type:              pulumi.String("xml"),
			Value:             pulumi.String(invokeFile.Result),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
using Std = Pulumi.Std;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example-rg",
        Location = "West Europe",
    });

    var exampleService = new Azure.ApiManagement.Service("example", new()
    {
        Name = "example-apim",
        Location = example.Location,
        ResourceGroupName = example.Name,
        PublisherName = "pub1",
        PublisherEmail = "pub1@email.com",
        SkuName = "Consumption_0",
    });

    var exampleGlobalSchema = new Azure.ApiManagement.GlobalSchema("example", new()
    {
        SchemaId = "example-schema1",
        ApiManagementName = exampleService.Name,
        ResourceGroupName = example.Name,
        Type = "xml",
        Value = Std.File.Invoke(new()
        {
            Input = "api_management_api_schema.xml",
        }).Apply(invoke => invoke.Result),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.apimanagement.Service;
import com.pulumi.azure.apimanagement.ServiceArgs;
import com.pulumi.azure.apimanagement.GlobalSchema;
import com.pulumi.azure.apimanagement.GlobalSchemaArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("example-rg")
            .location("West Europe")
            .build());

        var exampleService = new Service("exampleService", ServiceArgs.builder()
            .name("example-apim")
            .location(example.location())
            .resourceGroupName(example.name())
            .publisherName("pub1")
            .publisherEmail("pub1@email.com")
            .skuName("Consumption_0")
            .build());

        var exampleGlobalSchema = new GlobalSchema("exampleGlobalSchema", GlobalSchemaArgs.builder()
            .schemaId("example-schema1")
            .apiManagementName(exampleService.name())
            .resourceGroupName(example.name())
            .type("xml")
            .value(StdFunctions.file(FileArgs.builder()
                .input("api_management_api_schema.xml")
                .build()).result())
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-rg
      location: West Europe
  exampleService:
    type: azure:apimanagement:Service
    name: example
    properties:
      name: example-apim
      location: ${example.location}
      resourceGroupName: ${example.name}
      publisherName: pub1
      publisherEmail: pub1@email.com
      skuName: Consumption_0
  exampleGlobalSchema:
    type: azure:apimanagement:GlobalSchema
    name: example
    properties:
      schemaId: example-schema1
      apiManagementName: ${exampleService.name}
      resourceGroupName: ${example.name}
      type: xml
      value:
        fn::invoke:
          function: std:file
          arguments:
            input: api_management_api_schema.xml
          return: result
Copy

Create GlobalSchema Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new GlobalSchema(name: string, args: GlobalSchemaArgs, opts?: CustomResourceOptions);
@overload
def GlobalSchema(resource_name: str,
                 args: GlobalSchemaArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def GlobalSchema(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 api_management_name: Optional[str] = None,
                 resource_group_name: Optional[str] = None,
                 schema_id: Optional[str] = None,
                 type: Optional[str] = None,
                 value: Optional[str] = None,
                 description: Optional[str] = None)
func NewGlobalSchema(ctx *Context, name string, args GlobalSchemaArgs, opts ...ResourceOption) (*GlobalSchema, error)
public GlobalSchema(string name, GlobalSchemaArgs args, CustomResourceOptions? opts = null)
public GlobalSchema(String name, GlobalSchemaArgs args)
public GlobalSchema(String name, GlobalSchemaArgs args, CustomResourceOptions options)
type: azure:apimanagement:GlobalSchema
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. GlobalSchemaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. GlobalSchemaArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. GlobalSchemaArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. GlobalSchemaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. GlobalSchemaArgs
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 globalSchemaResource = new Azure.ApiManagement.GlobalSchema("globalSchemaResource", new()
{
    ApiManagementName = "string",
    ResourceGroupName = "string",
    SchemaId = "string",
    Type = "string",
    Value = "string",
    Description = "string",
});
Copy
example, err := apimanagement.NewGlobalSchema(ctx, "globalSchemaResource", &apimanagement.GlobalSchemaArgs{
	ApiManagementName: pulumi.String("string"),
	ResourceGroupName: pulumi.String("string"),
	SchemaId:          pulumi.String("string"),
	Type:              pulumi.String("string"),
	Value:             pulumi.String("string"),
	Description:       pulumi.String("string"),
})
Copy
var globalSchemaResource = new GlobalSchema("globalSchemaResource", GlobalSchemaArgs.builder()
    .apiManagementName("string")
    .resourceGroupName("string")
    .schemaId("string")
    .type("string")
    .value("string")
    .description("string")
    .build());
Copy
global_schema_resource = azure.apimanagement.GlobalSchema("globalSchemaResource",
    api_management_name="string",
    resource_group_name="string",
    schema_id="string",
    type="string",
    value="string",
    description="string")
Copy
const globalSchemaResource = new azure.apimanagement.GlobalSchema("globalSchemaResource", {
    apiManagementName: "string",
    resourceGroupName: "string",
    schemaId: "string",
    type: "string",
    value: "string",
    description: "string",
});
Copy
type: azure:apimanagement:GlobalSchema
properties:
    apiManagementName: string
    description: string
    resourceGroupName: string
    schemaId: string
    type: string
    value: string
Copy

GlobalSchema 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 GlobalSchema resource accepts the following input properties:

ApiManagementName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
SchemaId
This property is required.
Changes to this property will trigger replacement.
string
A unique identifier for this Schema. Changing this forces a new resource to be created.
Type This property is required. string
The content type of the Schema. Possible values are xml and json.
Value This property is required. string
The string defining the document representing the Schema.
Description string
The description of the schema.
ApiManagementName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
SchemaId
This property is required.
Changes to this property will trigger replacement.
string
A unique identifier for this Schema. Changing this forces a new resource to be created.
Type This property is required. string
The content type of the Schema. Possible values are xml and json.
Value This property is required. string
The string defining the document representing the Schema.
Description string
The description of the schema.
apiManagementName
This property is required.
Changes to this property will trigger replacement.
String
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
schemaId
This property is required.
Changes to this property will trigger replacement.
String
A unique identifier for this Schema. Changing this forces a new resource to be created.
type This property is required. String
The content type of the Schema. Possible values are xml and json.
value This property is required. String
The string defining the document representing the Schema.
description String
The description of the schema.
apiManagementName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
schemaId
This property is required.
Changes to this property will trigger replacement.
string
A unique identifier for this Schema. Changing this forces a new resource to be created.
type This property is required. string
The content type of the Schema. Possible values are xml and json.
value This property is required. string
The string defining the document representing the Schema.
description string
The description of the schema.
api_management_name
This property is required.
Changes to this property will trigger replacement.
str
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
schema_id
This property is required.
Changes to this property will trigger replacement.
str
A unique identifier for this Schema. Changing this forces a new resource to be created.
type This property is required. str
The content type of the Schema. Possible values are xml and json.
value This property is required. str
The string defining the document representing the Schema.
description str
The description of the schema.
apiManagementName
This property is required.
Changes to this property will trigger replacement.
String
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
schemaId
This property is required.
Changes to this property will trigger replacement.
String
A unique identifier for this Schema. Changing this forces a new resource to be created.
type This property is required. String
The content type of the Schema. Possible values are xml and json.
value This property is required. String
The string defining the document representing the Schema.
description String
The description of the schema.

Outputs

All input properties are implicitly available as output properties. Additionally, the GlobalSchema 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 GlobalSchema Resource

Get an existing GlobalSchema 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?: GlobalSchemaState, opts?: CustomResourceOptions): GlobalSchema
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_management_name: Optional[str] = None,
        description: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        schema_id: Optional[str] = None,
        type: Optional[str] = None,
        value: Optional[str] = None) -> GlobalSchema
func GetGlobalSchema(ctx *Context, name string, id IDInput, state *GlobalSchemaState, opts ...ResourceOption) (*GlobalSchema, error)
public static GlobalSchema Get(string name, Input<string> id, GlobalSchemaState? state, CustomResourceOptions? opts = null)
public static GlobalSchema get(String name, Output<String> id, GlobalSchemaState state, CustomResourceOptions options)
resources:  _:    type: azure:apimanagement:GlobalSchema    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
The following state arguments are supported:
ApiManagementName Changes to this property will trigger replacement. string
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
Description string
The description of the schema.
ResourceGroupName Changes to this property will trigger replacement. string
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
SchemaId Changes to this property will trigger replacement. string
A unique identifier for this Schema. Changing this forces a new resource to be created.
Type string
The content type of the Schema. Possible values are xml and json.
Value string
The string defining the document representing the Schema.
ApiManagementName Changes to this property will trigger replacement. string
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
Description string
The description of the schema.
ResourceGroupName Changes to this property will trigger replacement. string
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
SchemaId Changes to this property will trigger replacement. string
A unique identifier for this Schema. Changing this forces a new resource to be created.
Type string
The content type of the Schema. Possible values are xml and json.
Value string
The string defining the document representing the Schema.
apiManagementName Changes to this property will trigger replacement. String
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
description String
The description of the schema.
resourceGroupName Changes to this property will trigger replacement. String
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
schemaId Changes to this property will trigger replacement. String
A unique identifier for this Schema. Changing this forces a new resource to be created.
type String
The content type of the Schema. Possible values are xml and json.
value String
The string defining the document representing the Schema.
apiManagementName Changes to this property will trigger replacement. string
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
description string
The description of the schema.
resourceGroupName Changes to this property will trigger replacement. string
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
schemaId Changes to this property will trigger replacement. string
A unique identifier for this Schema. Changing this forces a new resource to be created.
type string
The content type of the Schema. Possible values are xml and json.
value string
The string defining the document representing the Schema.
api_management_name Changes to this property will trigger replacement. str
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
description str
The description of the schema.
resource_group_name Changes to this property will trigger replacement. str
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
schema_id Changes to this property will trigger replacement. str
A unique identifier for this Schema. Changing this forces a new resource to be created.
type str
The content type of the Schema. Possible values are xml and json.
value str
The string defining the document representing the Schema.
apiManagementName Changes to this property will trigger replacement. String
The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
description String
The description of the schema.
resourceGroupName Changes to this property will trigger replacement. String
The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
schemaId Changes to this property will trigger replacement. String
A unique identifier for this Schema. Changing this forces a new resource to be created.
type String
The content type of the Schema. Possible values are xml and json.
value String
The 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/globalSchema:GlobalSchema example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/schemas/schema1
Copy

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 azurerm Terraform Provider.