SharedAccessPolicy
Manages an IotHub Shared Access Policy
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West US",
});
var exampleIoTHub = new Azure.Iot.IoTHub("exampleIoTHub", new Azure.Iot.IoTHubArgs
{
ResourceGroupName = exampleResourceGroup.Name,
Location = exampleResourceGroup.Location,
Sku = new Azure.Iot.Inputs.IoTHubSkuArgs
{
Name = "S1",
Capacity = 1,
},
});
var exampleSharedAccessPolicy = new Azure.Iot.SharedAccessPolicy("exampleSharedAccessPolicy", new Azure.Iot.SharedAccessPolicyArgs
{
ResourceGroupName = exampleResourceGroup.Name,
IothubName = exampleIoTHub.Name,
RegistryRead = true,
RegistryWrite = true,
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/iot"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West US"),
})
if err != nil {
return err
}
exampleIoTHub, err := iot.NewIoTHub(ctx, "exampleIoTHub", &iot.IoTHubArgs{
ResourceGroupName: exampleResourceGroup.Name,
Location: exampleResourceGroup.Location,
Sku: &iot.IoTHubSkuArgs{
Name: pulumi.String("S1"),
Capacity: pulumi.Int(1),
},
})
if err != nil {
return err
}
_, err = iot.NewSharedAccessPolicy(ctx, "exampleSharedAccessPolicy", &iot.SharedAccessPolicyArgs{
ResourceGroupName: exampleResourceGroup.Name,
IothubName: exampleIoTHub.Name,
RegistryRead: pulumi.Bool(true),
RegistryWrite: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West US")
example_io_t_hub = azure.iot.IoTHub("exampleIoTHub",
resource_group_name=example_resource_group.name,
location=example_resource_group.location,
sku={
"name": "S1",
"capacity": "1",
})
example_shared_access_policy = azure.iot.SharedAccessPolicy("exampleSharedAccessPolicy",
resource_group_name=example_resource_group.name,
iothub_name=example_io_t_hub.name,
registry_read=True,
registry_write=True)import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West US"});
const exampleIoTHub = new azure.iot.IoTHub("exampleIoTHub", {
resourceGroupName: exampleResourceGroup.name,
location: exampleResourceGroup.location,
sku: {
name: "S1",
capacity: "1",
},
});
const exampleSharedAccessPolicy = new azure.iot.SharedAccessPolicy("exampleSharedAccessPolicy", {
resourceGroupName: exampleResourceGroup.name,
iothubName: exampleIoTHub.name,
registryRead: true,
registryWrite: true,
});Create a SharedAccessPolicy Resource
new SharedAccessPolicy(name: string, args: SharedAccessPolicyArgs, opts?: CustomResourceOptions);def SharedAccessPolicy(resource_name, opts=None, device_connect=None, iothub_name=None, name=None, registry_read=None, registry_write=None, resource_group_name=None, service_connect=None, __props__=None);func NewSharedAccessPolicy(ctx *Context, name string, args SharedAccessPolicyArgs, opts ...ResourceOption) (*SharedAccessPolicy, error)public SharedAccessPolicy(string name, SharedAccessPolicyArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args SharedAccessPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SharedAccessPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SharedAccessPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
SharedAccessPolicy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The SharedAccessPolicy resource accepts the following input properties:
- Iothub
Name string The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
- Device
Connect bool Adds
DeviceConnectpermission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.- Name string
Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
- Registry
Read bool Adds
RegistryReadpermission to this Shared Access Account. It allows read access to the identity registry.- Registry
Write bool Adds
RegistryWritepermission to this Shared Access Account. It allows write access to the identity registry.- Service
Connect bool Adds
ServiceConnectpermission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
- Iothub
Name string The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
- Device
Connect bool Adds
DeviceConnectpermission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.- Name string
Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
- Registry
Read bool Adds
RegistryReadpermission to this Shared Access Account. It allows read access to the identity registry.- Registry
Write bool Adds
RegistryWritepermission to this Shared Access Account. It allows write access to the identity registry.- Service
Connect bool Adds
ServiceConnectpermission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
- iothub
Name string The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
- resource
Group stringName The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
- device
Connect boolean Adds
DeviceConnectpermission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.- name string
Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
- registry
Read boolean Adds
RegistryReadpermission to this Shared Access Account. It allows read access to the identity registry.- registry
Write boolean Adds
RegistryWritepermission to this Shared Access Account. It allows write access to the identity registry.- service
Connect boolean Adds
ServiceConnectpermission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
- iothub_
name str The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
- resource_
group_ strname The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
- device_
connect bool Adds
DeviceConnectpermission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.- name str
Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
- registry_
read bool Adds
RegistryReadpermission to this Shared Access Account. It allows read access to the identity registry.- registry_
write bool Adds
RegistryWritepermission to this Shared Access Account. It allows write access to the identity registry.- service_
connect bool Adds
ServiceConnectpermission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
Outputs
All input properties are implicitly available as output properties. Additionally, the SharedAccessPolicy resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Primary
Connection stringString The primary connection string of the Shared Access Policy.
- Primary
Key string The primary key used to create the authentication token.
- Secondary
Connection stringString The secondary connection string of the Shared Access Policy.
- Secondary
Key string The secondary key used to create the authentication token.
- Id string
- The provider-assigned unique ID for this managed resource.
- Primary
Connection stringString The primary connection string of the Shared Access Policy.
- Primary
Key string The primary key used to create the authentication token.
- Secondary
Connection stringString The secondary connection string of the Shared Access Policy.
- Secondary
Key string The secondary key used to create the authentication token.
- id string
- The provider-assigned unique ID for this managed resource.
- primary
Connection stringString The primary connection string of the Shared Access Policy.
- primary
Key string The primary key used to create the authentication token.
- secondary
Connection stringString The secondary connection string of the Shared Access Policy.
- secondary
Key string The secondary key used to create the authentication token.
- id str
- The provider-assigned unique ID for this managed resource.
- primary_
connection_ strstring The primary connection string of the Shared Access Policy.
- primary_
key str The primary key used to create the authentication token.
- secondary_
connection_ strstring The secondary connection string of the Shared Access Policy.
- secondary_
key str The secondary key used to create the authentication token.
Look up an Existing SharedAccessPolicy Resource
Get an existing SharedAccessPolicy 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?: SharedAccessPolicyState, opts?: CustomResourceOptions): SharedAccessPolicystatic get(resource_name, id, opts=None, device_connect=None, iothub_name=None, name=None, primary_connection_string=None, primary_key=None, registry_read=None, registry_write=None, resource_group_name=None, secondary_connection_string=None, secondary_key=None, service_connect=None, __props__=None);func GetSharedAccessPolicy(ctx *Context, name string, id IDInput, state *SharedAccessPolicyState, opts ...ResourceOption) (*SharedAccessPolicy, error)public static SharedAccessPolicy Get(string name, Input<string> id, SharedAccessPolicyState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- Device
Connect bool Adds
DeviceConnectpermission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.- Iothub
Name string The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
- Name string
Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
- Primary
Connection stringString The primary connection string of the Shared Access Policy.
- Primary
Key string The primary key used to create the authentication token.
- Registry
Read bool Adds
RegistryReadpermission to this Shared Access Account. It allows read access to the identity registry.- Registry
Write bool Adds
RegistryWritepermission to this Shared Access Account. It allows write access to the identity registry.- Resource
Group stringName The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
- Secondary
Connection stringString The secondary connection string of the Shared Access Policy.
- Secondary
Key string The secondary key used to create the authentication token.
- Service
Connect bool Adds
ServiceConnectpermission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
- Device
Connect bool Adds
DeviceConnectpermission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.- Iothub
Name string The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
- Name string
Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
- Primary
Connection stringString The primary connection string of the Shared Access Policy.
- Primary
Key string The primary key used to create the authentication token.
- Registry
Read bool Adds
RegistryReadpermission to this Shared Access Account. It allows read access to the identity registry.- Registry
Write bool Adds
RegistryWritepermission to this Shared Access Account. It allows write access to the identity registry.- Resource
Group stringName The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
- Secondary
Connection stringString The secondary connection string of the Shared Access Policy.
- Secondary
Key string The secondary key used to create the authentication token.
- Service
Connect bool Adds
ServiceConnectpermission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
- device
Connect boolean Adds
DeviceConnectpermission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.- iothub
Name string The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
- name string
Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
- primary
Connection stringString The primary connection string of the Shared Access Policy.
- primary
Key string The primary key used to create the authentication token.
- registry
Read boolean Adds
RegistryReadpermission to this Shared Access Account. It allows read access to the identity registry.- registry
Write boolean Adds
RegistryWritepermission to this Shared Access Account. It allows write access to the identity registry.- resource
Group stringName The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
- secondary
Connection stringString The secondary connection string of the Shared Access Policy.
- secondary
Key string The secondary key used to create the authentication token.
- service
Connect boolean Adds
ServiceConnectpermission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
- device_
connect bool Adds
DeviceConnectpermission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.- iothub_
name str The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
- name str
Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
- primary_
connection_ strstring The primary connection string of the Shared Access Policy.
- primary_
key str The primary key used to create the authentication token.
- registry_
read bool Adds
RegistryReadpermission to this Shared Access Account. It allows read access to the identity registry.- registry_
write bool Adds
RegistryWritepermission to this Shared Access Account. It allows write access to the identity registry.- resource_
group_ strname The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
- secondary_
connection_ strstring The secondary connection string of the Shared Access Policy.
- secondary_
key str The secondary key used to create the authentication token.
- service_
connect bool Adds
ServiceConnectpermission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.