Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Manual steps to create azure resources for local setup

avanikp edited this page Jan 25, 2018 · 1 revision
  1. Deploy Required Azure Services
  2. Set Environment Variables

Deploy Required Azure Services

As you will be hosting the solution on your local machine, you can host most of the services locally and will not need all of the default deployed services like VMs. However, in order for your local setup to work there are a few services you will need:

  • [Azure IoT Hub][azure-iot-hub]
  • [Azure Storage Account][azure-storage-account]
  • [Azure Document Db][azure-document-db]
  1. Sign in at https://portal.azure.com

  2. Create a new [Azure IoT Hub][azure-iot-hub] image image

  3. Create an [Azure Storage Account][azure-storage-account] image image

  4. Create an [Azure Document Db][azure-document-db].

    a. image

    b. image

    c. Be sure to also set the consistency level to strong under Your Document Db > Default consistency > strong> save.

Set Environment Variables

The configuration files for each microservice reference some environment variables that need to be created at least once. These environment variables are used to specify connection information for your Azure resources, among other things. Local setup requires the following environment variables to be set:

  • PCS_TELEMETRY_DOCUMENTDB_CONNSTRING
  • PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING
  • PCS_TELEMETRYAGENT_DOCUMENTDB_CONNSTRING
  • PCS_IOTHUBREACT_AZUREBLOB_ACCOUNT
  • PCS_IOTHUBREACT_AZUREBLOB_KEY
  • PCS_IOTHUBREACT_AZUREBLOB_ENDPOINT_SUFFIX
  • PCS_IOTHUB_CONNSTRING
  • PCS_IOTHUBREACT_ACCESS_CONNSTRING
  • PCS_IOTHUBREACT_HUB_NAME
  • PCS_IOTHUBREACT_HUB_ENDPOINT
  • PCS_IOTHUBREACT_HUB_PARTITIONS
  1. Open the .env file under azure-iot-pcs-remote-monitoring-{runtime} > scripts > docker > local

Note: Environment variables set on local machine will always override the ones defined in .env file. Remove these environment variables from local machine if you are using .env file.

.env. This is the default environment variables file for docker-compose. Notice that the required environment variables are listed in this file.

  1. Locate the required strings in the Azure portal. You can refer to the instructions below to learn [Where to find required values for deployed Azure resources](#where-to find-required-values-for-deployed-azure-resources)
  2. Copy these values to the correct environment variable in the .env file. For example:
    PCS_IOTHUBREACT_HUB_PARTITIONS=4
    
  3. When you are finished you can refer to the instructions below to Run the solution with docker-compose

Where to find required values for deployed Azure resources

1. Locate your DocumentDb Connection string

  1. From the Azure portal navigate to the [DocumentDb][azure-document-db] created in Deploy Required Azure Services

  2. Locate the value for your DocumentDb connection string under Your Document Db > Keys > Primary Connection String

    image

2. Locate your Storage Account strings

For more information visit Manage your storage access keys.

  1. From the Azure portal navigate to the [Storage Account][azure-storage-account] created in Deploy Required Azure Services

  2. Locate the value for your Azure blob account and key under Your storage account > Access keys

    image

  3. Locate the value for your endpoint suffix under Your storage account > Properties > Primary Blob Service Endpoint > take the value in the URI after the "blob." (eg. core.windows.net)

    image

3. Locate your IoT Hub strings

For official documentation on IotHub strings please see Understand Different Connection Strings in Azure IoT Hub.

  1. From the Azure portal navigate to the [IoT Hub][azure-iot-hub] created in Deploy Required Azure Services.

  2. Locate the value for PCS_IOTHUB_CONNSTRING and PCS_IOTHUBREACT_ACCESS_CONNSTRING under Your IoT Hub > Shared access policies > Connection string -- primary key.

    image

  3. Locate the values for your hub name, endpoint, and partitions under Your IoT Hub > Endpoints > events.

    image