1. Packages
  2. Azure Classic
  3. API Docs
  4. connections
  5. ApiConnection

We recommend using Azure Native.

Azure v6.12.0 published on Monday, Dec 2, 2024 by Pulumi

azure.connections.ApiConnection

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure v6.12.0 published on Monday, Dec 2, 2024 by Pulumi

    Manages an API Connection.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "West Europe",
    });
    const example = azure.connections.getManagedApiOutput({
        name: "servicebus",
        location: exampleResourceGroup.location,
    });
    const exampleNamespace = new azure.servicebus.Namespace("example", {
        name: "acctestsbn-conn-example",
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        sku: "Basic",
    });
    const exampleApiConnection = new azure.connections.ApiConnection("example", {
        name: "example-connection",
        resourceGroupName: exampleResourceGroup.name,
        managedApiId: example.apply(example => example.id),
        displayName: "Example 1",
        parameterValues: {
            connectionString: exampleNamespace.defaultPrimaryConnectionString,
        },
        tags: {
            Hello: "World",
        },
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("example",
        name="example-resources",
        location="West Europe")
    example = azure.connections.get_managed_api_output(name="servicebus",
        location=example_resource_group.location)
    example_namespace = azure.servicebus.Namespace("example",
        name="acctestsbn-conn-example",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        sku="Basic")
    example_api_connection = azure.connections.ApiConnection("example",
        name="example-connection",
        resource_group_name=example_resource_group.name,
        managed_api_id=example.id,
        display_name="Example 1",
        parameter_values={
            "connectionString": example_namespace.default_primary_connection_string,
        },
        tags={
            "Hello": "World",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/connections"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/servicebus"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		example := connections.GetManagedApiOutput(ctx, connections.GetManagedApiOutputArgs{
    			Name:     pulumi.String("servicebus"),
    			Location: exampleResourceGroup.Location,
    		}, nil)
    		exampleNamespace, err := servicebus.NewNamespace(ctx, "example", &servicebus.NamespaceArgs{
    			Name:              pulumi.String("acctestsbn-conn-example"),
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			Sku:               pulumi.String("Basic"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = connections.NewApiConnection(ctx, "example", &connections.ApiConnectionArgs{
    			Name:              pulumi.String("example-connection"),
    			ResourceGroupName: exampleResourceGroup.Name,
    			ManagedApiId: pulumi.String(example.ApplyT(func(example connections.GetManagedApiResult) (*string, error) {
    				return &example.Id, nil
    			}).(pulumi.StringPtrOutput)),
    			DisplayName: pulumi.String("Example 1"),
    			ParameterValues: pulumi.StringMap{
    				"connectionString": exampleNamespace.DefaultPrimaryConnectionString,
    			},
    			Tags: pulumi.StringMap{
    				"Hello": pulumi.String("World"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "West Europe",
        });
    
        var example = Azure.Connections.GetManagedApi.Invoke(new()
        {
            Name = "servicebus",
            Location = exampleResourceGroup.Location,
        });
    
        var exampleNamespace = new Azure.ServiceBus.Namespace("example", new()
        {
            Name = "acctestsbn-conn-example",
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            Sku = "Basic",
        });
    
        var exampleApiConnection = new Azure.Connections.ApiConnection("example", new()
        {
            Name = "example-connection",
            ResourceGroupName = exampleResourceGroup.Name,
            ManagedApiId = example.Apply(getManagedApiResult => getManagedApiResult.Id),
            DisplayName = "Example 1",
            ParameterValues = 
            {
                { "connectionString", exampleNamespace.DefaultPrimaryConnectionString },
            },
            Tags = 
            {
                { "Hello", "World" },
            },
        });
    
    });
    
    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.connections.ConnectionsFunctions;
    import com.pulumi.azure.connections.inputs.GetManagedApiArgs;
    import com.pulumi.azure.servicebus.Namespace;
    import com.pulumi.azure.servicebus.NamespaceArgs;
    import com.pulumi.azure.connections.ApiConnection;
    import com.pulumi.azure.connections.ApiConnectionArgs;
    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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
                .name("example-resources")
                .location("West Europe")
                .build());
    
            final var example = ConnectionsFunctions.getManagedApi(GetManagedApiArgs.builder()
                .name("servicebus")
                .location(exampleResourceGroup.location())
                .build());
    
            var exampleNamespace = new Namespace("exampleNamespace", NamespaceArgs.builder()
                .name("acctestsbn-conn-example")
                .location(exampleResourceGroup.location())
                .resourceGroupName(exampleResourceGroup.name())
                .sku("Basic")
                .build());
    
            var exampleApiConnection = new ApiConnection("exampleApiConnection", ApiConnectionArgs.builder()
                .name("example-connection")
                .resourceGroupName(exampleResourceGroup.name())
                .managedApiId(example.applyValue(getManagedApiResult -> getManagedApiResult).applyValue(example -> example.applyValue(getManagedApiResult -> getManagedApiResult.id())))
                .displayName("Example 1")
                .parameterValues(Map.of("connectionString", exampleNamespace.defaultPrimaryConnectionString()))
                .tags(Map.of("Hello", "World"))
                .build());
    
        }
    }
    
    resources:
      exampleResourceGroup:
        type: azure:core:ResourceGroup
        name: example
        properties:
          name: example-resources
          location: West Europe
      exampleNamespace:
        type: azure:servicebus:Namespace
        name: example
        properties:
          name: acctestsbn-conn-example
          location: ${exampleResourceGroup.location}
          resourceGroupName: ${exampleResourceGroup.name}
          sku: Basic
      exampleApiConnection:
        type: azure:connections:ApiConnection
        name: example
        properties:
          name: example-connection
          resourceGroupName: ${exampleResourceGroup.name}
          managedApiId: ${example.id}
          displayName: Example 1
          parameterValues:
            connectionString: ${exampleNamespace.defaultPrimaryConnectionString}
          tags:
            Hello: World
    variables:
      example:
        fn::invoke:
          Function: azure:connections:getManagedApi
          Arguments:
            name: servicebus
            location: ${exampleResourceGroup.location}
    

    Create ApiConnection Resource

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

    Constructor syntax

    new ApiConnection(name: string, args: ApiConnectionArgs, opts?: CustomResourceOptions);
    @overload
    def ApiConnection(resource_name: str,
                      args: ApiConnectionArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApiConnection(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      managed_api_id: Optional[str] = None,
                      resource_group_name: Optional[str] = None,
                      display_name: Optional[str] = None,
                      name: Optional[str] = None,
                      parameter_values: Optional[Mapping[str, str]] = None,
                      tags: Optional[Mapping[str, str]] = None)
    func NewApiConnection(ctx *Context, name string, args ApiConnectionArgs, opts ...ResourceOption) (*ApiConnection, error)
    public ApiConnection(string name, ApiConnectionArgs args, CustomResourceOptions? opts = null)
    public ApiConnection(String name, ApiConnectionArgs args)
    public ApiConnection(String name, ApiConnectionArgs args, CustomResourceOptions options)
    
    type: azure:connections:ApiConnection
    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 ApiConnectionArgs
    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 ApiConnectionArgs
    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 ApiConnectionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApiConnectionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApiConnectionArgs
    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 apiConnectionResource = new Azure.Connections.ApiConnection("apiConnectionResource", new()
    {
        ManagedApiId = "string",
        ResourceGroupName = "string",
        DisplayName = "string",
        Name = "string",
        ParameterValues = 
        {
            { "string", "string" },
        },
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := connections.NewApiConnection(ctx, "apiConnectionResource", &connections.ApiConnectionArgs{
    	ManagedApiId:      pulumi.String("string"),
    	ResourceGroupName: pulumi.String("string"),
    	DisplayName:       pulumi.String("string"),
    	Name:              pulumi.String("string"),
    	ParameterValues: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var apiConnectionResource = new ApiConnection("apiConnectionResource", ApiConnectionArgs.builder()
        .managedApiId("string")
        .resourceGroupName("string")
        .displayName("string")
        .name("string")
        .parameterValues(Map.of("string", "string"))
        .tags(Map.of("string", "string"))
        .build());
    
    api_connection_resource = azure.connections.ApiConnection("apiConnectionResource",
        managed_api_id="string",
        resource_group_name="string",
        display_name="string",
        name="string",
        parameter_values={
            "string": "string",
        },
        tags={
            "string": "string",
        })
    
    const apiConnectionResource = new azure.connections.ApiConnection("apiConnectionResource", {
        managedApiId: "string",
        resourceGroupName: "string",
        displayName: "string",
        name: "string",
        parameterValues: {
            string: "string",
        },
        tags: {
            string: "string",
        },
    });
    
    type: azure:connections:ApiConnection
    properties:
        displayName: string
        managedApiId: string
        name: string
        parameterValues:
            string: string
        resourceGroupName: string
        tags:
            string: string
    

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

    ManagedApiId string
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    ResourceGroupName string
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    DisplayName string
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    Name string
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    ParameterValues Dictionary<string, string>
    Tags Dictionary<string, string>
    A mapping of tags which should be assigned to the API Connection.
    ManagedApiId string
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    ResourceGroupName string
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    DisplayName string
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    Name string
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    ParameterValues map[string]string
    Tags map[string]string
    A mapping of tags which should be assigned to the API Connection.
    managedApiId String
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    resourceGroupName String
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    displayName String
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    name String
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    parameterValues Map<String,String>
    tags Map<String,String>
    A mapping of tags which should be assigned to the API Connection.
    managedApiId string
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    resourceGroupName string
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    displayName string
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    name string
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    parameterValues {[key: string]: string}
    tags {[key: string]: string}
    A mapping of tags which should be assigned to the API Connection.
    managed_api_id str
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    resource_group_name str
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    display_name str
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    name str
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    parameter_values Mapping[str, str]
    tags Mapping[str, str]
    A mapping of tags which should be assigned to the API Connection.
    managedApiId String
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    resourceGroupName String
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    displayName String
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    name String
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    parameterValues Map<String>
    tags Map<String>
    A mapping of tags which should be assigned to the API Connection.

    Outputs

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

    Get an existing ApiConnection 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?: ApiConnectionState, opts?: CustomResourceOptions): ApiConnection
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            display_name: Optional[str] = None,
            managed_api_id: Optional[str] = None,
            name: Optional[str] = None,
            parameter_values: Optional[Mapping[str, str]] = None,
            resource_group_name: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None) -> ApiConnection
    func GetApiConnection(ctx *Context, name string, id IDInput, state *ApiConnectionState, opts ...ResourceOption) (*ApiConnection, error)
    public static ApiConnection Get(string name, Input<string> id, ApiConnectionState? state, CustomResourceOptions? opts = null)
    public static ApiConnection get(String name, Output<String> id, ApiConnectionState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    DisplayName string
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    ManagedApiId string
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    Name string
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    ParameterValues Dictionary<string, string>
    ResourceGroupName string
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    Tags Dictionary<string, string>
    A mapping of tags which should be assigned to the API Connection.
    DisplayName string
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    ManagedApiId string
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    Name string
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    ParameterValues map[string]string
    ResourceGroupName string
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    Tags map[string]string
    A mapping of tags which should be assigned to the API Connection.
    displayName String
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    managedApiId String
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    name String
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    parameterValues Map<String,String>
    resourceGroupName String
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    tags Map<String,String>
    A mapping of tags which should be assigned to the API Connection.
    displayName string
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    managedApiId string
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    name string
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    parameterValues {[key: string]: string}
    resourceGroupName string
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    tags {[key: string]: string}
    A mapping of tags which should be assigned to the API Connection.
    display_name str
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    managed_api_id str
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    name str
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    parameter_values Mapping[str, str]
    resource_group_name str
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    tags Mapping[str, str]
    A mapping of tags which should be assigned to the API Connection.
    displayName String
    A display name for this API Connection. Defaults to Service Bus. Changing this forces a new API Connection to be created.
    managedApiId String
    The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.
    name String
    The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.
    parameterValues Map<String>
    resourceGroupName String
    The name of the Resource Group where this API Connection should exist. Changing this forces a new API Connection to be created.
    tags Map<String>
    A mapping of tags which should be assigned to the API Connection.

    Import

    API Connections can be imported using the resource id, e.g.

    $ pulumi import azure:connections/apiConnection:ApiConnection example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.Web/connections/example-connection
    

    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.
    azure logo

    We recommend using Azure Native.

    Azure v6.12.0 published on Monday, Dec 2, 2024 by Pulumi