1. Packages
  2. Azure Classic
  3. API Docs
  4. batch
  5. Certificate

We recommend using Azure Native.

Azure Classic v5.58.0 published on Saturday, Dec 2, 2023 by Pulumi

azure.batch.Certificate

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.58.0 published on Saturday, Dec 2, 2023 by Pulumi

    Manages a certificate in an Azure Batch account.

    Example Usage

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    	private static string ReadFileBase64(string path) {
    		return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(File.ReadAllText(path)));
    	}
    
    return await Deployment.RunAsync(() => 
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
        {
            Location = "West Europe",
        });
    
        var exampleAccount = new Azure.Storage.Account("exampleAccount", new()
        {
            ResourceGroupName = exampleResourceGroup.Name,
            Location = exampleResourceGroup.Location,
            AccountTier = "Standard",
            AccountReplicationType = "LRS",
        });
    
        var exampleBatch_accountAccount = new Azure.Batch.Account("exampleBatch/accountAccount", new()
        {
            ResourceGroupName = exampleResourceGroup.Name,
            Location = exampleResourceGroup.Location,
            PoolAllocationMode = "BatchService",
            StorageAccountId = exampleAccount.Id,
            StorageAccountAuthenticationMode = "StorageKeys",
            Tags = 
            {
                { "env", "test" },
            },
        });
    
        var exampleCertificate = new Azure.Batch.Certificate("exampleCertificate", new()
        {
            ResourceGroupName = exampleResourceGroup.Name,
            AccountName = exampleBatch / accountAccount.Name,
            BatchCertificate = ReadFileBase64("certificate.pfx"),
            Format = "Pfx",
            Password = "password",
            Thumbprint = "42C107874FD0E4A9583292A2F1098E8FE4B2EDDA",
            ThumbprintAlgorithm = "SHA1",
        });
    
    });
    
    package main
    
    import (
    	"encoding/base64"
    	"os"
    
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/batch"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func filebase64OrPanic(path string) pulumi.StringPtrInput {
    	if fileData, err := os.ReadFile(path); err == nil {
    		return pulumi.String(base64.StdEncoding.EncodeToString(fileData[:]))
    	} else {
    		panic(err.Error())
    	}
    }
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleAccount, err := storage.NewAccount(ctx, "exampleAccount", &storage.AccountArgs{
    			ResourceGroupName:      exampleResourceGroup.Name,
    			Location:               exampleResourceGroup.Location,
    			AccountTier:            pulumi.String("Standard"),
    			AccountReplicationType: pulumi.String("LRS"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = batch.NewAccount(ctx, "exampleBatch/accountAccount", &batch.AccountArgs{
    			ResourceGroupName:                exampleResourceGroup.Name,
    			Location:                         exampleResourceGroup.Location,
    			PoolAllocationMode:               pulumi.String("BatchService"),
    			StorageAccountId:                 exampleAccount.ID(),
    			StorageAccountAuthenticationMode: pulumi.String("StorageKeys"),
    			Tags: pulumi.StringMap{
    				"env": pulumi.String("test"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = batch.NewCertificate(ctx, "exampleCertificate", &batch.CertificateArgs{
    			ResourceGroupName:   exampleResourceGroup.Name,
    			AccountName:         exampleBatch / accountAccount.Name,
    			Certificate:         filebase64OrPanic("certificate.pfx"),
    			Format:              pulumi.String("Pfx"),
    			Password:            pulumi.String("password"),
    			Thumbprint:          pulumi.String("42C107874FD0E4A9583292A2F1098E8FE4B2EDDA"),
    			ThumbprintAlgorithm: pulumi.String("SHA1"),
    		})
    		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.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.storage.Account;
    import com.pulumi.azure.storage.AccountArgs;
    import com.pulumi.azure.batch.Account;
    import com.pulumi.azure.batch.AccountArgs;
    import com.pulumi.azure.batch.Certificate;
    import com.pulumi.azure.batch.CertificateArgs;
    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()        
                .location("West Europe")
                .build());
    
            var exampleAccount = new Account("exampleAccount", AccountArgs.builder()        
                .resourceGroupName(exampleResourceGroup.name())
                .location(exampleResourceGroup.location())
                .accountTier("Standard")
                .accountReplicationType("LRS")
                .build());
    
            var exampleBatch_accountAccount = new Account("exampleBatch/accountAccount", AccountArgs.builder()        
                .resourceGroupName(exampleResourceGroup.name())
                .location(exampleResourceGroup.location())
                .poolAllocationMode("BatchService")
                .storageAccountId(exampleAccount.id())
                .storageAccountAuthenticationMode("StorageKeys")
                .tags(Map.of("env", "test"))
                .build());
    
            var exampleCertificate = new Certificate("exampleCertificate", CertificateArgs.builder()        
                .resourceGroupName(exampleResourceGroup.name())
                .accountName(exampleBatch / accountAccount.name())
                .certificate(Base64.getEncoder().encodeToString(Files.readAllBytes(Paths.get("certificate.pfx"))))
                .format("Pfx")
                .password("password")
                .thumbprint("42C107874FD0E4A9583292A2F1098E8FE4B2EDDA")
                .thumbprintAlgorithm("SHA1")
                .build());
    
        }
    }
    
    import pulumi
    import base64
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_account = azure.storage.Account("exampleAccount",
        resource_group_name=example_resource_group.name,
        location=example_resource_group.location,
        account_tier="Standard",
        account_replication_type="LRS")
    example_batch_account_account = azure.batch.Account("exampleBatch/accountAccount",
        resource_group_name=example_resource_group.name,
        location=example_resource_group.location,
        pool_allocation_mode="BatchService",
        storage_account_id=example_account.id,
        storage_account_authentication_mode="StorageKeys",
        tags={
            "env": "test",
        })
    example_certificate = azure.batch.Certificate("exampleCertificate",
        resource_group_name=example_resource_group.name,
        account_name=example_batch / account_account["name"],
        certificate=(lambda path: base64.b64encode(open(path).read().encode()).decode())("certificate.pfx"),
        format="Pfx",
        password="password",
        thumbprint="42C107874FD0E4A9583292A2F1098E8FE4B2EDDA",
        thumbprint_algorithm="SHA1")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    import * as fs from "fs";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleAccount = new azure.storage.Account("exampleAccount", {
        resourceGroupName: exampleResourceGroup.name,
        location: exampleResourceGroup.location,
        accountTier: "Standard",
        accountReplicationType: "LRS",
    });
    const exampleBatch_accountAccount = new azure.batch.Account("exampleBatch/accountAccount", {
        resourceGroupName: exampleResourceGroup.name,
        location: exampleResourceGroup.location,
        poolAllocationMode: "BatchService",
        storageAccountId: exampleAccount.id,
        storageAccountAuthenticationMode: "StorageKeys",
        tags: {
            env: "test",
        },
    });
    const exampleCertificate = new azure.batch.Certificate("exampleCertificate", {
        resourceGroupName: exampleResourceGroup.name,
        accountName: exampleBatch / accountAccount.name,
        certificate: Buffer.from(fs.readFileSync("certificate.pfx"), 'binary').toString('base64'),
        format: "Pfx",
        password: "password",
        thumbprint: "42C107874FD0E4A9583292A2F1098E8FE4B2EDDA",
        thumbprintAlgorithm: "SHA1",
    });
    

    Coming soon!

    Create Certificate Resource

    new Certificate(name: string, args: CertificateArgs, opts?: CustomResourceOptions);
    @overload
    def Certificate(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    account_name: Optional[str] = None,
                    certificate: Optional[str] = None,
                    format: Optional[str] = None,
                    password: Optional[str] = None,
                    resource_group_name: Optional[str] = None,
                    thumbprint: Optional[str] = None,
                    thumbprint_algorithm: Optional[str] = None)
    @overload
    def Certificate(resource_name: str,
                    args: CertificateArgs,
                    opts: Optional[ResourceOptions] = None)
    func NewCertificate(ctx *Context, name string, args CertificateArgs, opts ...ResourceOption) (*Certificate, error)
    public Certificate(string name, CertificateArgs args, CustomResourceOptions? opts = null)
    public Certificate(String name, CertificateArgs args)
    public Certificate(String name, CertificateArgs args, CustomResourceOptions options)
    
    type: azure:batch:Certificate
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args CertificateArgs
    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 CertificateArgs
    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 CertificateArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CertificateArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CertificateArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    AccountName string

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    BatchCertificate string

    The base64-encoded contents of the certificate.

    Format string

    The format of the certificate. Possible values are Cer or Pfx.

    ResourceGroupName string

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    Thumbprint string

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    ThumbprintAlgorithm string

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    Password string

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    AccountName string

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    Certificate string

    The base64-encoded contents of the certificate.

    Format string

    The format of the certificate. Possible values are Cer or Pfx.

    ResourceGroupName string

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    Thumbprint string

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    ThumbprintAlgorithm string

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    Password string

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    accountName String

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    certificate String

    The base64-encoded contents of the certificate.

    format String

    The format of the certificate. Possible values are Cer or Pfx.

    resourceGroupName String

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    thumbprint String

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    thumbprintAlgorithm String

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    password String

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    accountName string

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    certificate string

    The base64-encoded contents of the certificate.

    format string

    The format of the certificate. Possible values are Cer or Pfx.

    resourceGroupName string

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    thumbprint string

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    thumbprintAlgorithm string

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    password string

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    account_name str

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    certificate str

    The base64-encoded contents of the certificate.

    format str

    The format of the certificate. Possible values are Cer or Pfx.

    resource_group_name str

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    thumbprint str

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    thumbprint_algorithm str

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    password str

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    accountName String

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    certificate String

    The base64-encoded contents of the certificate.

    format String

    The format of the certificate. Possible values are Cer or Pfx.

    resourceGroupName String

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    thumbprint String

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    thumbprintAlgorithm String

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    password String

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Certificate resource produces the following output properties:

    Id string

    The provider-assigned unique ID for this managed resource.

    Name string

    The generated name of the certificate.

    PublicData string

    The public key of the certificate.

    Id string

    The provider-assigned unique ID for this managed resource.

    Name string

    The generated name of the certificate.

    PublicData string

    The public key of the certificate.

    id String

    The provider-assigned unique ID for this managed resource.

    name String

    The generated name of the certificate.

    publicData String

    The public key of the certificate.

    id string

    The provider-assigned unique ID for this managed resource.

    name string

    The generated name of the certificate.

    publicData string

    The public key of the certificate.

    id str

    The provider-assigned unique ID for this managed resource.

    name str

    The generated name of the certificate.

    public_data str

    The public key of the certificate.

    id String

    The provider-assigned unique ID for this managed resource.

    name String

    The generated name of the certificate.

    publicData String

    The public key of the certificate.

    Look up Existing Certificate Resource

    Get an existing Certificate 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?: CertificateState, opts?: CustomResourceOptions): Certificate
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_name: Optional[str] = None,
            certificate: Optional[str] = None,
            format: Optional[str] = None,
            name: Optional[str] = None,
            password: Optional[str] = None,
            public_data: Optional[str] = None,
            resource_group_name: Optional[str] = None,
            thumbprint: Optional[str] = None,
            thumbprint_algorithm: Optional[str] = None) -> Certificate
    func GetCertificate(ctx *Context, name string, id IDInput, state *CertificateState, opts ...ResourceOption) (*Certificate, error)
    public static Certificate Get(string name, Input<string> id, CertificateState? state, CustomResourceOptions? opts = null)
    public static Certificate get(String name, Output<String> id, CertificateState 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:
    AccountName string

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    BatchCertificate string

    The base64-encoded contents of the certificate.

    Format string

    The format of the certificate. Possible values are Cer or Pfx.

    Name string

    The generated name of the certificate.

    Password string

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    PublicData string

    The public key of the certificate.

    ResourceGroupName string

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    Thumbprint string

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    ThumbprintAlgorithm string

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    AccountName string

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    Certificate string

    The base64-encoded contents of the certificate.

    Format string

    The format of the certificate. Possible values are Cer or Pfx.

    Name string

    The generated name of the certificate.

    Password string

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    PublicData string

    The public key of the certificate.

    ResourceGroupName string

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    Thumbprint string

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    ThumbprintAlgorithm string

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    accountName String

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    certificate String

    The base64-encoded contents of the certificate.

    format String

    The format of the certificate. Possible values are Cer or Pfx.

    name String

    The generated name of the certificate.

    password String

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    publicData String

    The public key of the certificate.

    resourceGroupName String

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    thumbprint String

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    thumbprintAlgorithm String

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    accountName string

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    certificate string

    The base64-encoded contents of the certificate.

    format string

    The format of the certificate. Possible values are Cer or Pfx.

    name string

    The generated name of the certificate.

    password string

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    publicData string

    The public key of the certificate.

    resourceGroupName string

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    thumbprint string

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    thumbprintAlgorithm string

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    account_name str

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    certificate str

    The base64-encoded contents of the certificate.

    format str

    The format of the certificate. Possible values are Cer or Pfx.

    name str

    The generated name of the certificate.

    password str

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    public_data str

    The public key of the certificate.

    resource_group_name str

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    thumbprint str

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    thumbprint_algorithm str

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    accountName String

    Specifies the name of the Batch account. Changing this forces a new resource to be created.

    certificate String

    The base64-encoded contents of the certificate.

    format String

    The format of the certificate. Possible values are Cer or Pfx.

    name String

    The generated name of the certificate.

    password String

    The password to access the certificate's private key. This can only be specified when format is Pfx.

    publicData String

    The public key of the certificate.

    resourceGroupName String

    The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

    thumbprint String

    The thumbprint of the certificate. Changing this forces a new resource to be created.

    thumbprintAlgorithm String

    The algorithm of the certificate thumbprint. At this time the only supported value is SHA1. Changing this forces a new resource to be created.

    Import

    Batch Certificates can be imported using the resource id, e.g.

     $ pulumi import azure:batch/certificate:Certificate example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.Batch/batchAccounts/batch1/certificates/certificate1
    

    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.58.0 published on Saturday, Dec 2, 2023 by Pulumi