1. Packages
  2. Azure Classic
  3. API Docs
  4. keyvault
  5. CertificateContacts

We recommend using Azure Native.

Azure Classic v5.67.0 published on Wednesday, Feb 21, 2024 by Pulumi

azure.keyvault.CertificateContacts

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.67.0 published on Wednesday, Feb 21, 2024 by Pulumi

    Manages Key Vault Certificate Contacts.

    Disclaimers

    Note: It’s possible to define Key Vault Certificate Contacts both within the azure.keyvault.KeyVault resource via the contact block and by using the azure.keyvault.CertificateContacts resource. However it’s not possible to use both methods to manage Certificate Contacts within a KeyVault, since there’ll be conflicts.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var current = Azure.Core.GetClientConfig.Invoke();
    
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
        {
            Location = "West Europe",
        });
    
        var exampleKeyVault = new Azure.KeyVault.KeyVault("exampleKeyVault", new()
        {
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
            SkuName = "premium",
        });
    
        var exampleAccessPolicy = new Azure.KeyVault.AccessPolicy("exampleAccessPolicy", new()
        {
            KeyVaultId = exampleKeyVault.Id,
            TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
            ObjectId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
            CertificatePermissions = new[]
            {
                "ManageContacts",
            },
            KeyPermissions = new[]
            {
                "Create",
            },
            SecretPermissions = new[]
            {
                "Set",
            },
        });
    
        var exampleCertificateContacts = new Azure.KeyVault.CertificateContacts("exampleCertificateContacts", new()
        {
            KeyVaultId = exampleKeyVault.Id,
            Contacts = new[]
            {
                new Azure.KeyVault.Inputs.CertificateContactsContactArgs
                {
                    Email = "example@example.com",
                    Name = "example",
                    Phone = "01234567890",
                },
                new Azure.KeyVault.Inputs.CertificateContactsContactArgs
                {
                    Email = "example2@example.com",
                },
            },
        }, new CustomResourceOptions
        {
            DependsOn = new[]
            {
                exampleAccessPolicy,
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/keyvault"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		current, err := core.GetClientConfig(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleKeyVault, err := keyvault.NewKeyVault(ctx, "exampleKeyVault", &keyvault.KeyVaultArgs{
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			TenantId:          *pulumi.String(current.TenantId),
    			SkuName:           pulumi.String("premium"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleAccessPolicy, err := keyvault.NewAccessPolicy(ctx, "exampleAccessPolicy", &keyvault.AccessPolicyArgs{
    			KeyVaultId: exampleKeyVault.ID(),
    			TenantId:   *pulumi.String(current.TenantId),
    			ObjectId:   *pulumi.String(current.ObjectId),
    			CertificatePermissions: pulumi.StringArray{
    				pulumi.String("ManageContacts"),
    			},
    			KeyPermissions: pulumi.StringArray{
    				pulumi.String("Create"),
    			},
    			SecretPermissions: pulumi.StringArray{
    				pulumi.String("Set"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = keyvault.NewCertificateContacts(ctx, "exampleCertificateContacts", &keyvault.CertificateContactsArgs{
    			KeyVaultId: exampleKeyVault.ID(),
    			Contacts: keyvault.CertificateContactsContactArray{
    				&keyvault.CertificateContactsContactArgs{
    					Email: pulumi.String("example@example.com"),
    					Name:  pulumi.String("example"),
    					Phone: pulumi.String("01234567890"),
    				},
    				&keyvault.CertificateContactsContactArgs{
    					Email: pulumi.String("example2@example.com"),
    				},
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			exampleAccessPolicy,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.CoreFunctions;
    import com.pulumi.azure.core.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.keyvault.KeyVault;
    import com.pulumi.azure.keyvault.KeyVaultArgs;
    import com.pulumi.azure.keyvault.AccessPolicy;
    import com.pulumi.azure.keyvault.AccessPolicyArgs;
    import com.pulumi.azure.keyvault.CertificateContacts;
    import com.pulumi.azure.keyvault.CertificateContactsArgs;
    import com.pulumi.azure.keyvault.inputs.CertificateContactsContactArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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) {
            final var current = CoreFunctions.getClientConfig();
    
            var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
                .location("West Europe")
                .build());
    
            var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()        
                .location(exampleResourceGroup.location())
                .resourceGroupName(exampleResourceGroup.name())
                .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
                .skuName("premium")
                .build());
    
            var exampleAccessPolicy = new AccessPolicy("exampleAccessPolicy", AccessPolicyArgs.builder()        
                .keyVaultId(exampleKeyVault.id())
                .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
                .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
                .certificatePermissions("ManageContacts")
                .keyPermissions("Create")
                .secretPermissions("Set")
                .build());
    
            var exampleCertificateContacts = new CertificateContacts("exampleCertificateContacts", CertificateContactsArgs.builder()        
                .keyVaultId(exampleKeyVault.id())
                .contacts(            
                    CertificateContactsContactArgs.builder()
                        .email("example@example.com")
                        .name("example")
                        .phone("01234567890")
                        .build(),
                    CertificateContactsContactArgs.builder()
                        .email("example2@example.com")
                        .build())
                .build(), CustomResourceOptions.builder()
                    .dependsOn(exampleAccessPolicy)
                    .build());
    
        }
    }
    
    import pulumi
    import pulumi_azure as azure
    
    current = azure.core.get_client_config()
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_key_vault = azure.keyvault.KeyVault("exampleKeyVault",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        tenant_id=current.tenant_id,
        sku_name="premium")
    example_access_policy = azure.keyvault.AccessPolicy("exampleAccessPolicy",
        key_vault_id=example_key_vault.id,
        tenant_id=current.tenant_id,
        object_id=current.object_id,
        certificate_permissions=["ManageContacts"],
        key_permissions=["Create"],
        secret_permissions=["Set"])
    example_certificate_contacts = azure.keyvault.CertificateContacts("exampleCertificateContacts",
        key_vault_id=example_key_vault.id,
        contacts=[
            azure.keyvault.CertificateContactsContactArgs(
                email="example@example.com",
                name="example",
                phone="01234567890",
            ),
            azure.keyvault.CertificateContactsContactArgs(
                email="example2@example.com",
            ),
        ],
        opts=pulumi.ResourceOptions(depends_on=[example_access_policy]))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const current = azure.core.getClientConfig({});
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleKeyVault = new azure.keyvault.KeyVault("exampleKeyVault", {
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        tenantId: current.then(current => current.tenantId),
        skuName: "premium",
    });
    const exampleAccessPolicy = new azure.keyvault.AccessPolicy("exampleAccessPolicy", {
        keyVaultId: exampleKeyVault.id,
        tenantId: current.then(current => current.tenantId),
        objectId: current.then(current => current.objectId),
        certificatePermissions: ["ManageContacts"],
        keyPermissions: ["Create"],
        secretPermissions: ["Set"],
    });
    const exampleCertificateContacts = new azure.keyvault.CertificateContacts("exampleCertificateContacts", {
        keyVaultId: exampleKeyVault.id,
        contacts: [
            {
                email: "example@example.com",
                name: "example",
                phone: "01234567890",
            },
            {
                email: "example2@example.com",
            },
        ],
    }, {
        dependsOn: [exampleAccessPolicy],
    });
    
    resources:
      exampleResourceGroup:
        type: azure:core:ResourceGroup
        properties:
          location: West Europe
      exampleKeyVault:
        type: azure:keyvault:KeyVault
        properties:
          location: ${exampleResourceGroup.location}
          resourceGroupName: ${exampleResourceGroup.name}
          tenantId: ${current.tenantId}
          skuName: premium
      exampleAccessPolicy:
        type: azure:keyvault:AccessPolicy
        properties:
          keyVaultId: ${exampleKeyVault.id}
          tenantId: ${current.tenantId}
          objectId: ${current.objectId}
          certificatePermissions:
            - ManageContacts
          keyPermissions:
            - Create
          secretPermissions:
            - Set
      exampleCertificateContacts:
        type: azure:keyvault:CertificateContacts
        properties:
          keyVaultId: ${exampleKeyVault.id}
          contacts:
            - email: example@example.com
              name: example
              phone: '01234567890'
            - email: example2@example.com
        options:
          dependson:
            - ${exampleAccessPolicy}
    variables:
      current:
        fn::invoke:
          Function: azure:core:getClientConfig
          Arguments: {}
    

    Create CertificateContacts Resource

    new CertificateContacts(name: string, args: CertificateContactsArgs, opts?: CustomResourceOptions);
    @overload
    def CertificateContacts(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            contacts: Optional[Sequence[CertificateContactsContactArgs]] = None,
                            key_vault_id: Optional[str] = None)
    @overload
    def CertificateContacts(resource_name: str,
                            args: CertificateContactsArgs,
                            opts: Optional[ResourceOptions] = None)
    func NewCertificateContacts(ctx *Context, name string, args CertificateContactsArgs, opts ...ResourceOption) (*CertificateContacts, error)
    public CertificateContacts(string name, CertificateContactsArgs args, CustomResourceOptions? opts = null)
    public CertificateContacts(String name, CertificateContactsArgs args)
    public CertificateContacts(String name, CertificateContactsArgs args, CustomResourceOptions options)
    
    type: azure:keyvault:CertificateContacts
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args CertificateContactsArgs
    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 CertificateContactsArgs
    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 CertificateContactsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CertificateContactsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CertificateContactsArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    CertificateContacts Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The CertificateContacts resource accepts the following input properties:

    Contacts List<CertificateContactsContact>
    One or more contact blocks as defined below.
    KeyVaultId string
    The ID of the Key Vault. Changing this forces a new resource to be created.
    Contacts []CertificateContactsContactArgs
    One or more contact blocks as defined below.
    KeyVaultId string
    The ID of the Key Vault. Changing this forces a new resource to be created.
    contacts List<CertificateContactsContact>
    One or more contact blocks as defined below.
    keyVaultId String
    The ID of the Key Vault. Changing this forces a new resource to be created.
    contacts CertificateContactsContact[]
    One or more contact blocks as defined below.
    keyVaultId string
    The ID of the Key Vault. Changing this forces a new resource to be created.
    contacts Sequence[CertificateContactsContactArgs]
    One or more contact blocks as defined below.
    key_vault_id str
    The ID of the Key Vault. Changing this forces a new resource to be created.
    contacts List<Property Map>
    One or more contact blocks as defined below.
    keyVaultId String
    The ID of the Key Vault. Changing this forces a new resource to be created.

    Outputs

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

    Get an existing CertificateContacts 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?: CertificateContactsState, opts?: CustomResourceOptions): CertificateContacts
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            contacts: Optional[Sequence[CertificateContactsContactArgs]] = None,
            key_vault_id: Optional[str] = None) -> CertificateContacts
    func GetCertificateContacts(ctx *Context, name string, id IDInput, state *CertificateContactsState, opts ...ResourceOption) (*CertificateContacts, error)
    public static CertificateContacts Get(string name, Input<string> id, CertificateContactsState? state, CustomResourceOptions? opts = null)
    public static CertificateContacts get(String name, Output<String> id, CertificateContactsState 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:
    Contacts List<CertificateContactsContact>
    One or more contact blocks as defined below.
    KeyVaultId string
    The ID of the Key Vault. Changing this forces a new resource to be created.
    Contacts []CertificateContactsContactArgs
    One or more contact blocks as defined below.
    KeyVaultId string
    The ID of the Key Vault. Changing this forces a new resource to be created.
    contacts List<CertificateContactsContact>
    One or more contact blocks as defined below.
    keyVaultId String
    The ID of the Key Vault. Changing this forces a new resource to be created.
    contacts CertificateContactsContact[]
    One or more contact blocks as defined below.
    keyVaultId string
    The ID of the Key Vault. Changing this forces a new resource to be created.
    contacts Sequence[CertificateContactsContactArgs]
    One or more contact blocks as defined below.
    key_vault_id str
    The ID of the Key Vault. Changing this forces a new resource to be created.
    contacts List<Property Map>
    One or more contact blocks as defined below.
    keyVaultId String
    The ID of the Key Vault. Changing this forces a new resource to be created.

    Supporting Types

    CertificateContactsContact, CertificateContactsContactArgs

    Email string
    E-mail address of the contact.
    Name string
    Name of the contact.
    Phone string
    Phone number of the contact.
    Email string
    E-mail address of the contact.
    Name string
    Name of the contact.
    Phone string
    Phone number of the contact.
    email String
    E-mail address of the contact.
    name String
    Name of the contact.
    phone String
    Phone number of the contact.
    email string
    E-mail address of the contact.
    name string
    Name of the contact.
    phone string
    Phone number of the contact.
    email str
    E-mail address of the contact.
    name str
    Name of the contact.
    phone str
    Phone number of the contact.
    email String
    E-mail address of the contact.
    name String
    Name of the contact.
    phone String
    Phone number of the contact.

    Import

    Key Vault Certificate Contacts can be imported using the resource id, e.g.

    $ pulumi import azure:keyvault/certificateContacts:CertificateContacts example https://example-keyvault.vault.azure.net/certificates/contacts
    

    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 Classic v5.67.0 published on Wednesday, Feb 21, 2024 by Pulumi