-
Notifications
You must be signed in to change notification settings - Fork 95
Manual steps to create azure resources for local setup
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]
-
Sign in at https://portal.azure.com
-
Create a new [Azure IoT Hub][azure-iot-hub]
-
Create an [Azure Storage Account][azure-storage-account]
-
Create an [Azure Document Db][azure-document-db].
a.
b.
c. Be sure to also set the consistency level to
strong
under Your Document Db > Default consistency >strong
> save.
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
- 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.
- 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)
- Copy these values to the correct environment variable in the .env file. For example:
PCS_IOTHUBREACT_HUB_PARTITIONS=4
- When you are finished you can refer to the instructions below to Run the solution with docker-compose
-
From the Azure portal navigate to the [DocumentDb][azure-document-db] created in Deploy Required Azure Services
-
Locate the value for your DocumentDb connection string under Your Document Db > Keys > Primary Connection String
For more information visit Manage your storage access keys.
-
From the Azure portal navigate to the [Storage Account][azure-storage-account] created in Deploy Required Azure Services
-
Locate the value for your Azure blob account and key under Your storage account > Access keys
-
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
)
For official documentation on IotHub strings please see Understand Different Connection Strings in Azure IoT Hub.
-
From the Azure portal navigate to the [IoT Hub][azure-iot-hub] created in Deploy Required Azure Services.
-
Locate the value for
PCS_IOTHUB_CONNSTRING
andPCS_IOTHUBREACT_ACCESS_CONNSTRING
under Your IoT Hub > Shared access policies > Connection string -- primary key. -
Locate the values for your hub name, endpoint, and partitions under Your IoT Hub > Endpoints > events.