1. Packages
  2. Azure Classic
  3. API Docs
  4. iot
  5. getIotHub

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.iot.getIotHub

Explore with Pulumi AI

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

Use this data source to access information about an existing IoTHub.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.iot.getIotHub({
    name: "existing",
    resourceGroupName: "existing",
});
export const id = example.then(example => example.id);
Copy
import pulumi
import pulumi_azure as azure

example = azure.iot.get_iot_hub(name="existing",
    resource_group_name="existing")
pulumi.export("id", example.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/iot"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := iot.GetIotHub(ctx, &iot.GetIotHubArgs{
			Name:              "existing",
			ResourceGroupName: "existing",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("id", example.Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Iot.GetIotHub.Invoke(new()
    {
        Name = "existing",
        ResourceGroupName = "existing",
    });

    return new Dictionary<string, object?>
    {
        ["id"] = example.Apply(getIotHubResult => getIotHubResult.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.iot.IotFunctions;
import com.pulumi.azure.iot.inputs.GetIotHubArgs;
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 example = IotFunctions.getIotHub(GetIotHubArgs.builder()
            .name("existing")
            .resourceGroupName("existing")
            .build());

        ctx.export("id", example.applyValue(getIotHubResult -> getIotHubResult.id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:iot:getIotHub
      arguments:
        name: existing
        resourceGroupName: existing
outputs:
  id: ${example.id}
Copy

Using getIotHub

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getIotHub(args: GetIotHubArgs, opts?: InvokeOptions): Promise<GetIotHubResult>
function getIotHubOutput(args: GetIotHubOutputArgs, opts?: InvokeOptions): Output<GetIotHubResult>
Copy
def get_iot_hub(name: Optional[str] = None,
                resource_group_name: Optional[str] = None,
                tags: Optional[Mapping[str, str]] = None,
                opts: Optional[InvokeOptions] = None) -> GetIotHubResult
def get_iot_hub_output(name: Optional[pulumi.Input[str]] = None,
                resource_group_name: Optional[pulumi.Input[str]] = None,
                tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetIotHubResult]
Copy
func GetIotHub(ctx *Context, args *GetIotHubArgs, opts ...InvokeOption) (*GetIotHubResult, error)
func GetIotHubOutput(ctx *Context, args *GetIotHubOutputArgs, opts ...InvokeOption) GetIotHubResultOutput
Copy

> Note: This function is named GetIotHub in the Go SDK.

public static class GetIotHub 
{
    public static Task<GetIotHubResult> InvokeAsync(GetIotHubArgs args, InvokeOptions? opts = null)
    public static Output<GetIotHubResult> Invoke(GetIotHubInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetIotHubResult> getIotHub(GetIotHubArgs args, InvokeOptions options)
public static Output<GetIotHubResult> getIotHub(GetIotHubArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:iot/getIotHub:getIotHub
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of this IoTHub.
ResourceGroupName This property is required. string
The name of the Resource Group where the IoTHub exists.
Tags Dictionary<string, string>
A mapping of tags which should be assigned to the IoTHub.
Name This property is required. string
The name of this IoTHub.
ResourceGroupName This property is required. string
The name of the Resource Group where the IoTHub exists.
Tags map[string]string
A mapping of tags which should be assigned to the IoTHub.
name This property is required. String
The name of this IoTHub.
resourceGroupName This property is required. String
The name of the Resource Group where the IoTHub exists.
tags Map<String,String>
A mapping of tags which should be assigned to the IoTHub.
name This property is required. string
The name of this IoTHub.
resourceGroupName This property is required. string
The name of the Resource Group where the IoTHub exists.
tags {[key: string]: string}
A mapping of tags which should be assigned to the IoTHub.
name This property is required. str
The name of this IoTHub.
resource_group_name This property is required. str
The name of the Resource Group where the IoTHub exists.
tags Mapping[str, str]
A mapping of tags which should be assigned to the IoTHub.
name This property is required. String
The name of this IoTHub.
resourceGroupName This property is required. String
The name of the Resource Group where the IoTHub exists.
tags Map<String>
A mapping of tags which should be assigned to the IoTHub.

getIotHub Result

The following output properties are available:

Hostname string
The Hostname of the IoTHub.
Id string
The provider-assigned unique ID for this managed resource.
Identities List<GetIotHubIdentity>
A identity block as defined below.
Name string
ResourceGroupName string
Tags Dictionary<string, string>
Hostname string
The Hostname of the IoTHub.
Id string
The provider-assigned unique ID for this managed resource.
Identities []GetIotHubIdentity
A identity block as defined below.
Name string
ResourceGroupName string
Tags map[string]string
hostname String
The Hostname of the IoTHub.
id String
The provider-assigned unique ID for this managed resource.
identities List<GetIotHubIdentity>
A identity block as defined below.
name String
resourceGroupName String
tags Map<String,String>
hostname string
The Hostname of the IoTHub.
id string
The provider-assigned unique ID for this managed resource.
identities GetIotHubIdentity[]
A identity block as defined below.
name string
resourceGroupName string
tags {[key: string]: string}
hostname str
The Hostname of the IoTHub.
id str
The provider-assigned unique ID for this managed resource.
identities Sequence[GetIotHubIdentity]
A identity block as defined below.
name str
resource_group_name str
tags Mapping[str, str]
hostname String
The Hostname of the IoTHub.
id String
The provider-assigned unique ID for this managed resource.
identities List<Property Map>
A identity block as defined below.
name String
resourceGroupName String
tags Map<String>

Supporting Types

GetIotHubIdentity

IdentityIds This property is required. List<string>
The list of User Managed Identity IDs which are assigned to the Virtual Machine.
PrincipalId This property is required. string
The ID of the System Managed Service Principal assigned to the Virtual Machine.
TenantId This property is required. string
The ID of the Tenant of the System Managed Service Principal assigned to the Virtual Machine.
Type This property is required. string
The identity type of the Managed Identity assigned to the Virtual Machine.
IdentityIds This property is required. []string
The list of User Managed Identity IDs which are assigned to the Virtual Machine.
PrincipalId This property is required. string
The ID of the System Managed Service Principal assigned to the Virtual Machine.
TenantId This property is required. string
The ID of the Tenant of the System Managed Service Principal assigned to the Virtual Machine.
Type This property is required. string
The identity type of the Managed Identity assigned to the Virtual Machine.
identityIds This property is required. List<String>
The list of User Managed Identity IDs which are assigned to the Virtual Machine.
principalId This property is required. String
The ID of the System Managed Service Principal assigned to the Virtual Machine.
tenantId This property is required. String
The ID of the Tenant of the System Managed Service Principal assigned to the Virtual Machine.
type This property is required. String
The identity type of the Managed Identity assigned to the Virtual Machine.
identityIds This property is required. string[]
The list of User Managed Identity IDs which are assigned to the Virtual Machine.
principalId This property is required. string
The ID of the System Managed Service Principal assigned to the Virtual Machine.
tenantId This property is required. string
The ID of the Tenant of the System Managed Service Principal assigned to the Virtual Machine.
type This property is required. string
The identity type of the Managed Identity assigned to the Virtual Machine.
identity_ids This property is required. Sequence[str]
The list of User Managed Identity IDs which are assigned to the Virtual Machine.
principal_id This property is required. str
The ID of the System Managed Service Principal assigned to the Virtual Machine.
tenant_id This property is required. str
The ID of the Tenant of the System Managed Service Principal assigned to the Virtual Machine.
type This property is required. str
The identity type of the Managed Identity assigned to the Virtual Machine.
identityIds This property is required. List<String>
The list of User Managed Identity IDs which are assigned to the Virtual Machine.
principalId This property is required. String
The ID of the System Managed Service Principal assigned to the Virtual Machine.
tenantId This property is required. String
The ID of the Tenant of the System Managed Service Principal assigned to the Virtual Machine.
type This property is required. String
The identity type of the Managed Identity assigned to the Virtual Machine.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi