'How to get the WorkspaceKey after creating a Pulumi.AzureNative.OperationalInsights.Workspace?

I create a Pulumi.AzureNative.OperationalInsights.Workspace with the following:

    name = "workspace";
    var workspace = 
      new Workspace
      (
        name, 
        new WorkspaceArgs
        {
          Location = resourceGroup.Location,
          ResourceGroupName = resourceGroup.Name,
          RetentionInDays = 30,
          Sku = new WorkspaceSkuArgs
          {
            Name = WorkspaceSkuNameEnum.PerGB2018,
          },
          Tags =
                {
                    { "tag1", "val1" },
                },
          WorkspaceName = name,
        }
      );

Later I want to connect my ContainerGroup to this workspace and need the WorkspaceId and WorkspaceKey.

Where can I get those values?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source