Azure Classic

Pulumi Official
Package maintained by Pulumi
v5.11.0 published on Monday, Jun 27, 2022 by Pulumi

PublicCertificate

Manages an App Service Public Certificate.

Example Usage

using System;
using System.IO;
using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
	private static string ReadFileBase64(string path) {
		return Convert.ToBase64String(Encoding.UTF8.GetBytes(File.ReadAllText(path)))
	}

    public MyStack()
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
        {
            Location = "West Europe",
        });
        var examplePlan = new Azure.AppService.Plan("examplePlan", new Azure.AppService.PlanArgs
        {
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            Sku = new Azure.AppService.Inputs.PlanSkuArgs
            {
                Tier = "Standard",
                Size = "S1",
            },
        });
        var exampleAppService = new Azure.AppService.AppService("exampleAppService", new Azure.AppService.AppServiceArgs
        {
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            AppServicePlanId = examplePlan.Id,
        });
        var examplePublicCertificate = new Azure.AppService.PublicCertificate("examplePublicCertificate", new Azure.AppService.PublicCertificateArgs
        {
            ResourceGroupName = exampleResourceGroup.Name,
            AppServiceName = exampleAppService.Name,
            CertificateName = "example-public-certificate",
            CertificateLocation = "Unknown",
            Blob = ReadFileBase64("app_service_public_certificate.cer"),
        });
    }

}
package main

import (
	"encoding/base64"
	"io/ioutil"

	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func filebase64OrPanic(path string) pulumi.StringPtrInput {
	if fileData, err := ioutil.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
		}
		examplePlan, err := appservice.NewPlan(ctx, "examplePlan", &appservice.PlanArgs{
			Location:          exampleResourceGroup.Location,
			ResourceGroupName: exampleResourceGroup.Name,
			Sku: &appservice.PlanSkuArgs{
				Tier: pulumi.String("Standard"),
				Size: pulumi.String("S1"),
			},
		})
		if err != nil {
			return err
		}
		exampleAppService, err := appservice.NewAppService(ctx, "exampleAppService", &appservice.AppServiceArgs{
			Location:          exampleResourceGroup.Location,
			ResourceGroupName: exampleResourceGroup.Name,
			AppServicePlanId:  examplePlan.ID(),
		})
		if err != nil {
			return err
		}
		_, err = appservice.NewPublicCertificate(ctx, "examplePublicCertificate", &appservice.PublicCertificateArgs{
			ResourceGroupName:   exampleResourceGroup.Name,
			AppServiceName:      exampleAppService.Name,
			CertificateName:     pulumi.String("example-public-certificate"),
			CertificateLocation: pulumi.String("Unknown"),
			Blob:                filebase64OrPanic("app_service_public_certificate.cer"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

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 examplePlan = new Plan("examplePlan", PlanArgs.builder()        
            .location(exampleResourceGroup.location())
            .resourceGroupName(exampleResourceGroup.name())
            .sku(PlanSkuArgs.builder()
                .tier("Standard")
                .size("S1")
                .build())
            .build());

        var exampleAppService = new AppService("exampleAppService", AppServiceArgs.builder()        
            .location(exampleResourceGroup.location())
            .resourceGroupName(exampleResourceGroup.name())
            .appServicePlanId(examplePlan.id())
            .build());

        var examplePublicCertificate = new PublicCertificate("examplePublicCertificate", PublicCertificateArgs.builder()        
            .resourceGroupName(exampleResourceGroup.name())
            .appServiceName(exampleAppService.name())
            .certificateName("example-public-certificate")
            .certificateLocation("Unknown")
            .blob(Base64.getEncoder().encodeToString(Files.readAllBytes(Paths.get("app_service_public_certificate.cer"))))
            .build());

    }
}
import pulumi
import base64
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_plan = azure.appservice.Plan("examplePlan",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    sku=azure.appservice.PlanSkuArgs(
        tier="Standard",
        size="S1",
    ))
example_app_service = azure.appservice.AppService("exampleAppService",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    app_service_plan_id=example_plan.id)
example_public_certificate = azure.appservice.PublicCertificate("examplePublicCertificate",
    resource_group_name=example_resource_group.name,
    app_service_name=example_app_service.name,
    certificate_name="example-public-certificate",
    certificate_location="Unknown",
    blob=(lambda path: base64.b64encode(open(path).read().encode()).decode())("app_service_public_certificate.cer"))
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * from "fs";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const examplePlan = new azure.appservice.Plan("examplePlan", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    sku: {
        tier: "Standard",
        size: "S1",
    },
});
const exampleAppService = new azure.appservice.AppService("exampleAppService", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    appServicePlanId: examplePlan.id,
});
const examplePublicCertificate = new azure.appservice.PublicCertificate("examplePublicCertificate", {
    resourceGroupName: exampleResourceGroup.name,
    appServiceName: exampleAppService.name,
    certificateName: "example-public-certificate",
    certificateLocation: "Unknown",
    blob: Buffer.from(fs.readFileSync("app_service_public_certificate.cer"), 'binary').toString('base64'),
});

Coming soon!

Create a PublicCertificate Resource

new PublicCertificate(name: string, args: PublicCertificateArgs, opts?: CustomResourceOptions);
@overload
def PublicCertificate(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      app_service_name: Optional[str] = None,
                      blob: Optional[str] = None,
                      certificate_location: Optional[str] = None,
                      certificate_name: Optional[str] = None,
                      resource_group_name: Optional[str] = None)
@overload
def PublicCertificate(resource_name: str,
                      args: PublicCertificateArgs,
                      opts: Optional[ResourceOptions] = None)
func NewPublicCertificate(ctx *Context, name string, args PublicCertificateArgs, opts ...ResourceOption) (*PublicCertificate, error)
public PublicCertificate(string name, PublicCertificateArgs args, CustomResourceOptions? opts = null)
public PublicCertificate(String name, PublicCertificateArgs args)
public PublicCertificate(String name, PublicCertificateArgs args, CustomResourceOptions options)
type: azure:appservice:PublicCertificate
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args PublicCertificateArgs
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 PublicCertificateArgs
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 PublicCertificateArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args PublicCertificateArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args PublicCertificateArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

AppServiceName string

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

Blob string

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

CertificateLocation string

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

CertificateName string

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

ResourceGroupName string

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

AppServiceName string

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

Blob string

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

CertificateLocation string

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

CertificateName string

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

ResourceGroupName string

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

appServiceName String

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

blob String

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

certificateLocation String

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

certificateName String

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

resourceGroupName String

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

appServiceName string

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

blob string

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

certificateLocation string

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

certificateName string

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

resourceGroupName string

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

app_service_name str

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

blob str

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

certificate_location str

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

certificate_name str

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

resource_group_name str

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

appServiceName String

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

blob String

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

certificateLocation String

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

certificateName String

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

resourceGroupName String

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Thumbprint string

The thumbprint of the public certificate.

Id string

The provider-assigned unique ID for this managed resource.

Thumbprint string

The thumbprint of the public certificate.

id String

The provider-assigned unique ID for this managed resource.

thumbprint String

The thumbprint of the public certificate.

id string

The provider-assigned unique ID for this managed resource.

thumbprint string

The thumbprint of the public certificate.

id str

The provider-assigned unique ID for this managed resource.

thumbprint str

The thumbprint of the public certificate.

id String

The provider-assigned unique ID for this managed resource.

thumbprint String

The thumbprint of the public certificate.

Look up an Existing PublicCertificate Resource

Get an existing PublicCertificate 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?: PublicCertificateState, opts?: CustomResourceOptions): PublicCertificate
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        app_service_name: Optional[str] = None,
        blob: Optional[str] = None,
        certificate_location: Optional[str] = None,
        certificate_name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        thumbprint: Optional[str] = None) -> PublicCertificate
func GetPublicCertificate(ctx *Context, name string, id IDInput, state *PublicCertificateState, opts ...ResourceOption) (*PublicCertificate, error)
public static PublicCertificate Get(string name, Input<string> id, PublicCertificateState? state, CustomResourceOptions? opts = null)
public static PublicCertificate get(String name, Output<String> id, PublicCertificateState 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:
AppServiceName string

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

Blob string

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

CertificateLocation string

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

CertificateName string

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

ResourceGroupName string

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

Thumbprint string

The thumbprint of the public certificate.

AppServiceName string

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

Blob string

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

CertificateLocation string

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

CertificateName string

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

ResourceGroupName string

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

Thumbprint string

The thumbprint of the public certificate.

appServiceName String

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

blob String

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

certificateLocation String

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

certificateName String

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

resourceGroupName String

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

thumbprint String

The thumbprint of the public certificate.

appServiceName string

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

blob string

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

certificateLocation string

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

certificateName string

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

resourceGroupName string

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

thumbprint string

The thumbprint of the public certificate.

app_service_name str

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

blob str

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

certificate_location str

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

certificate_name str

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

resource_group_name str

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

thumbprint str

The thumbprint of the public certificate.

appServiceName String

The name of the App Service. Changing this forces a new App Service Public Certificate to be created.

blob String

The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.

certificateLocation String

The location of the certificate. Possible values are CurrentUserMy, LocalMachineMy and Unknown.

certificateName String

The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.

resourceGroupName String

The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.

thumbprint String

The thumbprint of the public certificate.

Import

App Service Public Certificates can be imported using the resource id, e.g.

 $ pulumi import azure:appservice/publicCertificate:PublicCertificate example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Web/sites/site1/publicCertificates/publicCertificate1

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.