![]() ![]() # Create a SAS token to adding to the queue SASToken = $(az storage queue generate-sas \ -name $storageQueueName \ The token is stored in a variable for output at the end of our build. We create it with a long expiry (2099), and permissions to only ( a)dd to the queue using https. In our case, the Smartthings platform will be using it to submit events to the queue. SAS tokens are used to provide access to storage account resources outside Azure. connection-string $storageConnectionString # Create a storage queue to receive smartthings eventsĪz storage queue create \ -name $storageQueueName \ As events are submitted to the queue, they’re held there until another resource (our function) dequeues and processes them. The storage queue exists inside the storage account itself, and is designed to allow asynchronous event handling. resource-group $resourceGroupName \ -name $storageName \ -query connectionString \ -output tsv ) # Save the connection string for use later storageConnectionString = $(az storage account show-connection-string \ To facilitate that, let’s extract the connection string and store it in a variable for re-use. resource-group $resourceGroupName \ -sku Standard_LRSĬommands further on will require access to the storage account. # Create an Azure storage account in the resource group.Īz storage account create \ -name $storageName \ -location $region \ We use the Standard_LRS sku for locally redundant data storage. # Create a resource group.Īz group create -name $resourceGroupName -location $region In Azure, resources belong to a resource group, so let’s create that first. StorageName =ststorageaccount $RANDOM storageQueueName =steventsįunctionAppName =qtocosmos $RANDOM region =canadacentralĬosmosAccountName =cosmos $RANDOM cosmosDBName =smarthomeĬosmosFreeTier =false # if this is your first cosmos DB, set to true # User Settings resourceGroupName =smartthings If this is your first CosmosDB, set this to true. cosmosFreeTier: Azure has a Cosmos free tier, but you only get one.Run az account list-locations -query '.name' for an updated list. region: the location to host the resources.storageName: storage account name must be globally unique.To keep everything together, suggest creating a new one called smartthings or similar. resourceGroupName: the name of the resource group.Most of the defaults are fine, but please pay extra attention to these: Create the Azure ResourcesĮach of the following commands assume you’re using a bash-like shell, and the Azure CLI. ![]() To build this, let’s start by creating the Azure resources.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |