We recommend using Azure Native.
azure.keyvault.CertificateContacts
Explore with Pulumi AI
Manages Key Vault Certificate Contacts.
Disclaimers
Note: It’s possible to define Key Vault Certificate Contacts both within the
azure.keyvault.KeyVault
resource via thecontact
block and by using theazure.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
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const current = azure.core.getClientConfig({});
const example = new azure.core.ResourceGroup("example", {
name: "example-resources",
location: "West Europe",
});
const exampleKeyVault = new azure.keyvault.KeyVault("example", {
name: "examplekeyvault",
location: example.location,
resourceGroupName: example.name,
tenantId: current.then(current => current.tenantId),
skuName: "premium",
});
const exampleAccessPolicy = new azure.keyvault.AccessPolicy("example", {
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("example", {
keyVaultId: exampleKeyVault.id,
contacts: [
{
email: "example@example.com",
name: "example",
phone: "01234567890",
},
{
email: "example2@example.com",
},
],
}, {
dependsOn: [exampleAccessPolicy],
});
import pulumi
import pulumi_azure as azure
current = azure.core.get_client_config()
example = azure.core.ResourceGroup("example",
name="example-resources",
location="West Europe")
example_key_vault = azure.keyvault.KeyVault("example",
name="examplekeyvault",
location=example.location,
resource_group_name=example.name,
tenant_id=current.tenant_id,
sku_name="premium")
example_access_policy = azure.keyvault.AccessPolicy("example",
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("example",
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]))
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
}
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("example-resources"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleKeyVault, err := keyvault.NewKeyVault(ctx, "example", &keyvault.KeyVaultArgs{
Name: pulumi.String("examplekeyvault"),
Location: example.Location,
ResourceGroupName: example.Name,
TenantId: pulumi.String(current.TenantId),
SkuName: pulumi.String("premium"),
})
if err != nil {
return err
}
exampleAccessPolicy, err := keyvault.NewAccessPolicy(ctx, "example", &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, "example", &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
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var current = Azure.Core.GetClientConfig.Invoke();
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "example-resources",
Location = "West Europe",
});
var exampleKeyVault = new Azure.KeyVault.KeyVault("example", new()
{
Name = "examplekeyvault",
Location = example.Location,
ResourceGroupName = example.Name,
TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
SkuName = "premium",
});
var exampleAccessPolicy = new Azure.KeyVault.AccessPolicy("example", 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("example", 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 =
{
exampleAccessPolicy,
},
});
});
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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-resources")
.location("West Europe")
.build());
var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
.name("examplekeyvault")
.location(example.location())
.resourceGroupName(example.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());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
exampleKeyVault:
type: azure:keyvault:KeyVault
name: example
properties:
name: examplekeyvault
location: ${example.location}
resourceGroupName: ${example.name}
tenantId: ${current.tenantId}
skuName: premium
exampleAccessPolicy:
type: azure:keyvault:AccessPolicy
name: example
properties:
keyVaultId: ${exampleKeyVault.id}
tenantId: ${current.tenantId}
objectId: ${current.objectId}
certificatePermissions:
- ManageContacts
keyPermissions:
- Create
secretPermissions:
- Set
exampleCertificateContacts:
type: azure:keyvault:CertificateContacts
name: example
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
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CertificateContacts(name: string, args: CertificateContactsArgs, opts?: CustomResourceOptions);
@overload
def CertificateContacts(resource_name: str,
args: CertificateContactsArgs,
opts: Optional[ResourceOptions] = None)
@overload
def CertificateContacts(resource_name: str,
opts: Optional[ResourceOptions] = None,
contacts: Optional[Sequence[CertificateContactsContactArgs]] = None,
key_vault_id: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var certificateContactsResource = new Azure.KeyVault.CertificateContacts("certificateContactsResource", new()
{
Contacts = new[]
{
new Azure.KeyVault.Inputs.CertificateContactsContactArgs
{
Email = "string",
Name = "string",
Phone = "string",
},
},
KeyVaultId = "string",
});
example, err := keyvault.NewCertificateContacts(ctx, "certificateContactsResource", &keyvault.CertificateContactsArgs{
Contacts: keyvault.CertificateContactsContactArray{
&keyvault.CertificateContactsContactArgs{
Email: pulumi.String("string"),
Name: pulumi.String("string"),
Phone: pulumi.String("string"),
},
},
KeyVaultId: pulumi.String("string"),
})
var certificateContactsResource = new CertificateContacts("certificateContactsResource", CertificateContactsArgs.builder()
.contacts(CertificateContactsContactArgs.builder()
.email("string")
.name("string")
.phone("string")
.build())
.keyVaultId("string")
.build());
certificate_contacts_resource = azure.keyvault.CertificateContacts("certificateContactsResource",
contacts=[azure.keyvault.CertificateContactsContactArgs(
email="string",
name="string",
phone="string",
)],
key_vault_id="string")
const certificateContactsResource = new azure.keyvault.CertificateContacts("certificateContactsResource", {
contacts: [{
email: "string",
name: "string",
phone: "string",
}],
keyVaultId: "string",
});
type: azure:keyvault:CertificateContacts
properties:
contacts:
- email: string
name: string
phone: string
keyVaultId: string
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<Certificate
Contacts Contact> - One or more
contact
blocks as defined below. --> - Key
Vault stringId - The ID of the Key Vault. Changing this forces a new resource to be created.
- Contacts
[]Certificate
Contacts Contact Args - One or more
contact
blocks as defined below. --> - Key
Vault stringId - The ID of the Key Vault. Changing this forces a new resource to be created.
- contacts
List<Certificate
Contacts Contact> - One or more
contact
blocks as defined below. --> - key
Vault StringId - The ID of the Key Vault. Changing this forces a new resource to be created.
- contacts
Certificate
Contacts Contact[] - One or more
contact
blocks as defined below. --> - key
Vault stringId - The ID of the Key Vault. Changing this forces a new resource to be created.
- contacts
Sequence[Certificate
Contacts Contact Args] - One or more
contact
blocks as defined below. --> - key_
vault_ strid - 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. --> - key
Vault StringId - 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.
- Contacts
List<Certificate
Contacts Contact> - One or more
contact
blocks as defined below. --> - Key
Vault stringId - The ID of the Key Vault. Changing this forces a new resource to be created.
- Contacts
[]Certificate
Contacts Contact Args - One or more
contact
blocks as defined below. --> - Key
Vault stringId - The ID of the Key Vault. Changing this forces a new resource to be created.
- contacts
List<Certificate
Contacts Contact> - One or more
contact
blocks as defined below. --> - key
Vault StringId - The ID of the Key Vault. Changing this forces a new resource to be created.
- contacts
Certificate
Contacts Contact[] - One or more
contact
blocks as defined below. --> - key
Vault stringId - The ID of the Key Vault. Changing this forces a new resource to be created.
- contacts
Sequence[Certificate
Contacts Contact Args] - One or more
contact
blocks as defined below. --> - key_
vault_ strid - 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. --> - key
Vault StringId - The ID of the Key Vault. Changing this forces a new resource to be created.
Supporting Types
CertificateContactsContact, CertificateContactsContactArgs
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
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.