# Resources This document explains how to get started using Azure Resources Service with Fog. With this gem you can create, update, list or delete resource groups. ## Usage First of all, you need to require the Fog library by executing: ```ruby require 'fog/azurerm' ``` ## Create Connection Next, create a connection to the Resources Service: ```ruby fog_resources_service = Fog::Resources::AzureRM.new( tenant_id: '', # Tenant Id of Azure Active Directory Application client_id: '', # Client Id of Azure Active Directory Application client_secret: '', # Client Secret of Azure Active Directory Application subscription_id: '', # Subscription Id of an Azure Account environment: '' # Azure cloud environment. Default is AzureCloud. ) ``` ## Check Resource Group Existence ```ruby fog_resources_service.resource_groups.check_resource_group_exists('') ``` ## Create Resource Group Create a new resource group ```ruby fog_resources_service.resource_groups.create( name: '', location: '', tags: { key1: 'value1', key2: 'value2', keyN: 'valueN' } # [Optional] ) ``` ## List Resource Groups ```ruby fog_resources_service.resource_groups.each do |resource_group| puts "#{resource_group.name}" puts "#{resource_group.location}" end ``` ## Retrieve a single Resource Group Get a single record of Resource Group ```ruby resource_group = fog_resources_service .resource_groups .get('') puts "#{resource_group.name}" ``` ## Destroy a single Resource Group Get resource group object from the get method(described above) and then destroy that resource group. ```ruby resource_group.destroy ``` ## Tagging a Resource You can tag a Resource as following: ```ruby fog_resources_service.tag_resource( '', '', '', '' ) ``` ## List Tagged Resources in a Subscription ```ruby fog_resources_service.azure_resources(tag_name: '', tag_value: '').each do |resource| puts "#{resource.name}" puts "#{resource.location}" puts "#{resource.type}" end ``` OR ```ruby fog_resources_service.azure_resources(tag_name: '').each do |resource| puts "#{resource.name}" puts "#{resource.location}" puts "#{resource.type}" end ``` ## Retrieve a single Resource Get a single record of Tagged Resources ```ruby resource = fog_resources_service .azure_resources(tag_name: '') .get('') puts "#{resource.name}" ``` ## Remove tag from a Resource Remove tag from a resource as following: ```ruby fog_resources_service.delete_resource_tag( '', '', '', '' ) ``` ## Check Resource Existence ```ruby fog_resources_service.azure_resources.check_azure_resource_exists('', '') ``` ## Check Deployment Existence ```ruby fog_resources_service.deployments.check_deployment_exists('', '') ``` ## Create Deployment Create a Deployment ```ruby fog_resources_service.deployments.create( name: '', resource_group: '', template_link: '