From 2d83efedc835daa7e885c86645a3f3ae06d64abf Mon Sep 17 00:00:00 2001 From: Sathish Date: Thu, 23 Sep 2021 11:27:54 +0530 Subject: [PATCH 01/10] Support Azure Power BI embedded capacity (s) Signed-off-by: Sathish --- .../azure_power_bi_embedded_capacities.rb | 44 +++++++++++++++++++ libraries/azure_power_bi_embedded_capacity.rb | 22 ++++++++++ 2 files changed, 66 insertions(+) create mode 100644 libraries/azure_power_bi_embedded_capacities.rb create mode 100644 libraries/azure_power_bi_embedded_capacity.rb diff --git a/libraries/azure_power_bi_embedded_capacities.rb b/libraries/azure_power_bi_embedded_capacities.rb new file mode 100644 index 000000000..e7d70f0b9 --- /dev/null +++ b/libraries/azure_power_bi_embedded_capacities.rb @@ -0,0 +1,44 @@ +require 'azure_generic_resources' + +class AzurePowerBiEmbeddedCapacities < AzureGenericResources + name 'azure_power_bi_embedded_capacities' + desc 'Retrieves and verifies the settings of all Azure Power BI Embedded Capacities.' + example <<-EXAMPLE + describe azure_power_bi_embedded_capacities do + it { should exist } + end + EXAMPLE + + def initialize(opts = {}) + raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash) + + opts[:resource_provider] = specific_resource_constraint('Microsoft.PowerBIDedicated/capacities', opts) + super(opts, true) + return if failed_resource? + + populate_filter_table_from_response + end + + def to_s + super(AzurePowerBiEmbeddedCapacities) + end + + private + + def populate_table + @resources.each do |resource| + props = resource[:properties] + sku_hash = concat_keys(resource[:sku], 'sku') + administration_attrs = concat_keys(props[:administration], 'administration') + @table << resource.merge(resource[:properties]) + .merge(sku_hash) + .merge(administration_attrs) + end + end + + def concat_keys(props, concat_prefix = nil) + return unless concat_prefix + + props.each_with_object({}) { |(key, value), hash| hash["#{concat_prefix}_#{key}".to_sym] = value } + end +end diff --git a/libraries/azure_power_bi_embedded_capacity.rb b/libraries/azure_power_bi_embedded_capacity.rb new file mode 100644 index 000000000..99555a3db --- /dev/null +++ b/libraries/azure_power_bi_embedded_capacity.rb @@ -0,0 +1,22 @@ +require 'azure_generic_resource' + +class AzurePowerBiEmbeddedCapacity < AzureGenericResource + name 'azure_power_bi_embedded_capacity' + desc 'Retrieves and verifies the settings of an Azure Power BI Embedded Capacity.' + example <<-EXAMPLE + describe azure_power_bi_embedded_capacity(resource_group: 'migrate_vms', name: 'MigrateEvent01') do + it { should exist } + end + EXAMPLE + + def initialize(opts = {}) + raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash) + + opts[:resource_provider] = specific_resource_constraint('Microsoft.PowerBIDedicated/capacities', opts) + super(opts, true) + end + + def to_s + super(AzurePowerBiEmbeddedCapacity) + end +end From 4e85b817f49474b9e841788c024674fa2c42047a Mon Sep 17 00:00:00 2001 From: Sathish Date: Thu, 23 Sep 2021 11:28:03 +0530 Subject: [PATCH 02/10] unit test Azure Power BI embedded capacity (s) Signed-off-by: Sathish --- ...azure_power_bi_embedded_capacities_test.rb | 21 +++++++++++++++++++ .../azure_power_bi_embedded_capacity_test.rb | 17 +++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 test/unit/resources/azure_power_bi_embedded_capacities_test.rb create mode 100644 test/unit/resources/azure_power_bi_embedded_capacity_test.rb diff --git a/test/unit/resources/azure_power_bi_embedded_capacities_test.rb b/test/unit/resources/azure_power_bi_embedded_capacities_test.rb new file mode 100644 index 000000000..43fcd9fc7 --- /dev/null +++ b/test/unit/resources/azure_power_bi_embedded_capacities_test.rb @@ -0,0 +1,21 @@ +require_relative 'helper' +require 'azure_power_bi_embedded_capacities' + +class AzurePowerBiEmbeddedCapacitiesConstructorTest < Minitest::Test + # resource_type should not be allowed. + def test_resource_type_not_ok + assert_raises(ArgumentError) { AzurePowerBiEmbeddedCapacities.new(resource_provider: 'some_type') } + end + + def tag_value_not_ok + assert_raises(ArgumentError) { AzurePowerBiEmbeddedCapacities.new(tag_value: 'some_tag_value') } + end + + def tag_name_not_ok + assert_raises(ArgumentError) { AzurePowerBiEmbeddedCapacities.new(tag_name: 'some_tag_name') } + end + + def test_name_not_ok + assert_raises(ArgumentError) { AzurePowerBiEmbeddedCapacities.new(name: 'some_name') } + end +end diff --git a/test/unit/resources/azure_power_bi_embedded_capacity_test.rb b/test/unit/resources/azure_power_bi_embedded_capacity_test.rb new file mode 100644 index 000000000..06741a16f --- /dev/null +++ b/test/unit/resources/azure_power_bi_embedded_capacity_test.rb @@ -0,0 +1,17 @@ +require_relative 'helper' +require 'azure_power_bi_embedded_capacity' + +class AzurePowerBiEmbeddedCapacityConstructorTest < Minitest::Test + def test_empty_param_not_ok + assert_raises(ArgumentError) { AzurePowerBiEmbeddedCapacity.new } + end + + # resource_provider should not be allowed. + def test_resource_provider_not_ok + assert_raises(ArgumentError) { AzurePowerBiEmbeddedCapacity.new(resource_provider: 'some_type') } + end + + def test_resource_group_name_alone_ok + assert_raises(ArgumentError) { AzurePowerBiEmbeddedCapacity.new(resource_group: 'test') } + end +end From e8697535e41aef8fedcedd480dcbd95b03e55f12 Mon Sep 17 00:00:00 2001 From: Sathish Date: Thu, 23 Sep 2021 11:28:12 +0530 Subject: [PATCH 03/10] integral test Azure Power BI embedded capacity (s) Signed-off-by: Sathish --- .../verify/controls/azure_power_bi_embedded_capacities.rb | 8 ++++++++ .../verify/controls/azure_power_bi_embedded_capacity.rb | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/integration/verify/controls/azure_power_bi_embedded_capacities.rb create mode 100644 test/integration/verify/controls/azure_power_bi_embedded_capacity.rb diff --git a/test/integration/verify/controls/azure_power_bi_embedded_capacities.rb b/test/integration/verify/controls/azure_power_bi_embedded_capacities.rb new file mode 100644 index 000000000..fe12a01c6 --- /dev/null +++ b/test/integration/verify/controls/azure_power_bi_embedded_capacities.rb @@ -0,0 +1,8 @@ +capacity_name = input(:power_bi_embedded_capacity_name, value: '') + +control 'Verify settings for Azure Power BI Embedded Capacity' do + describe azure_power_bi_embedded_capacities do + it { should exist } + its('names') { should include capacity_name } + end +end diff --git a/test/integration/verify/controls/azure_power_bi_embedded_capacity.rb b/test/integration/verify/controls/azure_power_bi_embedded_capacity.rb new file mode 100644 index 000000000..fe88302b0 --- /dev/null +++ b/test/integration/verify/controls/azure_power_bi_embedded_capacity.rb @@ -0,0 +1,8 @@ +resource_group = input(:resource_group, value: '') +capacity_name = input(:power_bi_embedded_capacity_name, value: '') + +control 'Verify settings for Azure Power BI Embedded Capacity' do + describe azure_power_bi_embedded_capacity(resource_group: resource_group, name: capacity_name) do + it { should exist } + end +end From 2b8d5737dd19ac2b772318f1d58e1af1c842ba93 Mon Sep 17 00:00:00 2001 From: Sathish Date: Thu, 23 Sep 2021 11:29:26 +0530 Subject: [PATCH 04/10] add tf resource for power BI embedded Signed-off-by: Sathish --- terraform/azure.tf | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/terraform/azure.tf b/terraform/azure.tf index 0f03d20a2..46d9a33e8 100644 --- a/terraform/azure.tf +++ b/terraform/azure.tf @@ -3,7 +3,7 @@ terraform { } provider "azurerm" { - version = "~> 2.1.0" + version = "~> 2.2.0" subscription_id = var.subscription_id client_id = var.client_id client_secret = var.client_secret @@ -1424,4 +1424,12 @@ resource "azurerm_virtual_wan" "inspec-nw-wan" { location = var.location name = var.inspec_wan_name resource_group_name = azurerm_resource_group.rg.name +} + +resource "azurerm_powerbi_embedded" "power_bi_embedded" { + name = var.power_bi_embedded_name + location = azurerm_resource_group.rg.location + resource_group_name = azurerm_resource_group.rg.name + sku_name = "A1" + administrators = ["sbabu@progress.com"] } \ No newline at end of file From 803d5c6eba38268b5a73a37ab02bab0abd54314b Mon Sep 17 00:00:00 2001 From: Sathish Date: Thu, 23 Sep 2021 11:29:47 +0530 Subject: [PATCH 05/10] add o/p and variables for tf Signed-off-by: Sathish --- terraform/outputs.tf | 5 +++++ terraform/variables.tf | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/terraform/outputs.tf b/terraform/outputs.tf index d06ed0dea..128106929 100644 --- a/terraform/outputs.tf +++ b/terraform/outputs.tf @@ -493,3 +493,8 @@ output "inspec_virtual_wan" { description = "The resource name of the inspec virtual WAN" value = azurerm_virtual_wan.inspec-nw-wan.name } + +output "power_bi_embedded_name" { + description = "The name of the Power BI Embedded" + value = azurerm_powerbi_embedded.power_bi_embedded.name +} \ No newline at end of file diff --git a/terraform/variables.tf b/terraform/variables.tf index 525fe923a..9d918ae5b 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -178,3 +178,7 @@ variable "inspec_compliance_redis_cache_name" { variable "inspec_wan_name" { default = "inspec-nw-wan" } + +variable "power_bi_embedded_name" { + default = "inspecdevbi" +} \ No newline at end of file From 1863fa15a6e4c0ca29a21f43a26795e96e9c9223 Mon Sep 17 00:00:00 2001 From: Sathish Date: Thu, 23 Sep 2021 20:51:46 +0530 Subject: [PATCH 06/10] integral test embedded capacity Signed-off-by: Sathish --- .../controls/azure_power_bi_embedded_capacities.rb | 11 ++++++++--- .../controls/azure_power_bi_embedded_capacity.rb | 7 +++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/test/integration/verify/controls/azure_power_bi_embedded_capacities.rb b/test/integration/verify/controls/azure_power_bi_embedded_capacities.rb index fe12a01c6..40f3f57d2 100644 --- a/test/integration/verify/controls/azure_power_bi_embedded_capacities.rb +++ b/test/integration/verify/controls/azure_power_bi_embedded_capacities.rb @@ -1,8 +1,13 @@ -capacity_name = input(:power_bi_embedded_capacity_name, value: '') +power_bi_embedded_name = input(:power_bi_embedded_name, value: '') +location = input(:location, value: '') -control 'Verify settings for Azure Power BI Embedded Capacity' do +control 'Verify settings for all Azure Power BI Embedded Capacities' do describe azure_power_bi_embedded_capacities do it { should exist } - its('names') { should include capacity_name } + its('names') { should include power_bi_embedded_name } + its('locations') { should include location } + its('modes') { should include 'Gen2' } + its('sku_names') { should include 'A1' } + its('sku_capacities') { should include 1 } end end diff --git a/test/integration/verify/controls/azure_power_bi_embedded_capacity.rb b/test/integration/verify/controls/azure_power_bi_embedded_capacity.rb index fe88302b0..ca7b19854 100644 --- a/test/integration/verify/controls/azure_power_bi_embedded_capacity.rb +++ b/test/integration/verify/controls/azure_power_bi_embedded_capacity.rb @@ -1,8 +1,11 @@ resource_group = input(:resource_group, value: '') -capacity_name = input(:power_bi_embedded_capacity_name, value: '') +power_bi_embedded_name = input(:power_bi_embedded_name, value: '') control 'Verify settings for Azure Power BI Embedded Capacity' do - describe azure_power_bi_embedded_capacity(resource_group: resource_group, name: capacity_name) do + describe azure_power_bi_embedded_capacity(resource_group: resource_group, name: power_bi_embedded_name) do it { should exist } + its('properties.mode') { should include 'Gen2' } + its('sku.name') { should eq 'A1' } + its('sku.capacity') { should eq 1 } end end From c4d03ecbf4fd448dcfd4952434023dffa5bb9d69 Mon Sep 17 00:00:00 2001 From: Sathish Date: Thu, 23 Sep 2021 21:30:33 +0530 Subject: [PATCH 07/10] update docs Signed-off-by: Sathish --- .../azure_power_bi_embedded_capacities.md | 102 ++++++++++++++++++ .../azure_power_bi_embedded_capacity.md | 98 +++++++++++++++++ libraries/azure_power_bi_embedded_capacity.rb | 2 +- 3 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 docs/resources/azure_power_bi_embedded_capacities.md create mode 100644 docs/resources/azure_power_bi_embedded_capacity.md diff --git a/docs/resources/azure_power_bi_embedded_capacities.md b/docs/resources/azure_power_bi_embedded_capacities.md new file mode 100644 index 000000000..14d5dddee --- /dev/null +++ b/docs/resources/azure_power_bi_embedded_capacities.md @@ -0,0 +1,102 @@ +--- +title: About the azure_power_bi_embedded_capacities Resource +platform: azure +--- + +# azure_power_bi_embedded_capacities + +Use the `azure_power_bi_embedded_capacities` InSpec audit resource to test the properties related to all Azure Power BI Embedded Capacities within a project. + +## Azure REST API version, Endpoint, and HTTP Client Parameters + +This resource interacts with API versions supported by the resource provider. The `api_version` is defined as a resource parameter. +If not provided, the latest version is used. For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). + +Unless defined, `azure_cloud` global endpoint and default values for the HTTP client is used. For more information, refer to the resource pack [README](../../README.md). + +## Availability + +### Installation + +This resource is available in the [InSpec Azure resource pack](https://github.com/inspec/inspec-azure). For an example, `inspec.yml` file and how to set up your Azure credentials, refer to resource pack [README](../../README.md#Service-Principal). + +## Syntax + +An `azure_power_bi_embedded_capacities` resource block returns all Azure Power BI Embedded Capacities within a project. + +```ruby +describe azure_power_bi_embedded_capacities do + #... +end +``` + +## Parameters +| Name | Description | +|----------------|----------------------------------------------------------------------------------| +| account_name | The Azure Storage account name. | +| dns_suffix | The DNS suffix for the Azure Data Lake Storage endpoint. | + +The parameter set should be provided for a valid query: +- `account_name` +- `account_name` and `dns_suffix` (optional) + +## Properties + +|Property | Description | Filter Criteria* | +|--------------------|---------------------------------------------------------------|------------------| +| ids | A list of PowerBI Dedicated resources. | `id` | +| names | The names of all the PowerBI Dedicated resource. | `name` | +| locations | A list of all locations of all the PowerBI Dedicated resource.| `location` | +| modes | A list of all the capacity modes. | `mode` | +| provisioningStates | A list of all provisioning state. |`provisioningState`| +| states | The current state of all PowerBI Dedicated resources. | `state` | +| sku_names | The SKU name of the PowerBI Dedicated resource. | `sku_name` | +| sku_tiers | The SKU tier of the PowerBI Dedicated resource. | `sku_tier` | +| sku_capacities | The SKU capacities of the PowerBI Dedicated resource. | `sku_capacity` | +| administration_members | A collection of Dedicated capacity administrators. | `administration_members` | + + + +* For information on how to use filter criteria on plural resources refer to [FilterTable usage](https://github.com/inspec/inspec/blob/master/dev-docs/filtertable-usage.md). +Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/list) for other properties available. + +## Examples + +### Loop through Power BI Embedded Capacities by their names + +```ruby +azure_power_bi_embedded_capacities.names.each do |name| + describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: name) do + it { should exist } + end +end +``` + +### Test to ensure Power BI Embedded Capacities where sku_capacities greater than 1 + +```ruby +describe azure_power_bi_embedded_capacities.where(sku_capacity > 1 ) do + it { should exist } +end +``` + +## Matchers + +This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [Universal Matchers page](https://www.inspec.io/docs/reference/matchers/). + +### exists + +```ruby +# Should not exist if no Power BI Embedded Capacities are present in the project and in the resource group +describe azure_power_bi_embedded_capacities do + it { should_not exist } +end +# Should exist if the filter returns at least one Migrate Assessment in the project and in the resource group +describe azure_power_bi_embedded_capacities do + it { should exist } +end +``` + +## Azure Permissions + +Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be set up with a `contributor` role on the subscription you wish to test. \ No newline at end of file diff --git a/docs/resources/azure_power_bi_embedded_capacity.md b/docs/resources/azure_power_bi_embedded_capacity.md new file mode 100644 index 000000000..689a7194b --- /dev/null +++ b/docs/resources/azure_power_bi_embedded_capacity.md @@ -0,0 +1,98 @@ +--- +title: About the azure_power_bi_embedded_capacity Resource +platform: azure +--- + +# azure_power_bi_embedded_capacity + +Use the `azure_power_bi_embedded_capacity` InSpec audit resource to test the properties related to Azure Power BI Embedded Capacity. + +## Azure REST API version, Endpoint, and HTTP Client Parameters + +This resource interacts with API versions supported by the resource provider. The `api_version` is defined as a resource parameter. +If not provided, the latest version is used. For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). + +Unless defined, `azure_cloud` global endpoint and default values for the HTTP client are used. For more information, refer to the resource pack [README](../../README.md). + +## Availability + +### Installation + +This resource is available in the [InSpec Azure resource pack](https://github.com/inspec/inspec-azure). For an example, `inspec.yml` file and how to set up your Azure credentials, refer to resource pack [README](../../README.md#Service-Principal). + +## Syntax + +`name` and `resource_group` is a required parameter. + +```ruby +describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do + it { should exist } +end +``` + +```ruby +describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do + it { should exist } +end +``` + +## Parameters + +| Name | Description | +|----------------|----------------------------------------------------------------------------------| +| name | Name of the Power BI Embedded Capacity to test. | +| resource_group | Azure Resource Group. | + +The parameter set should be provided for a valid query: + +- `name` and `account_name` + +## Properties + +| Property | Description | +|----------------------------|------------------------------------------------------------------| +| id | An identifier that represents the PowerBI Dedicated resource. | +| location | Location of the PowerBI Dedicated resource. | +| name | The name of the PowerBI Dedicated resource. | +| properties.administration | A collection of Dedicated capacity administrators. | +| properties.mode | The capacity mode. | +| properties.state | The current state of PowerBI Dedicated resource. The state is to indicate more states outside of resource provisioning.| +| sku | The SKU of the PowerBI Dedicated resource. | +| tags | Key-value pairs of additional resource provisioning properties. | +| type | The type of the PowerBI Dedicated resource. | + + +For properties applicable to all resources, such as `type`, `name`, `id`, and `properties`, refer to [`azure_generic_resource`](azure_generic_resource.md#properties). + +Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/get-details) for other properties available. + +## Examples + +### Test that the Power BI Embedded Capacity + +```ruby +describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do + its() { should eq 1.0 } +end +``` + +## Matchers + +This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [Universal Matchers page](/inspec/matchers/). + +### exists + +```ruby +# If the Power BI Embedded Capacity is found, it will exist +describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do + it { should exist } +end +# if the Power BI Embedded Capacity is not found, it will not exist +describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do + it { should_not exist } +end +``` + +## Azure Permissions + +Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be set up with a `contributor` role on the subscription you wish to test. \ No newline at end of file diff --git a/libraries/azure_power_bi_embedded_capacity.rb b/libraries/azure_power_bi_embedded_capacity.rb index 99555a3db..75d54e305 100644 --- a/libraries/azure_power_bi_embedded_capacity.rb +++ b/libraries/azure_power_bi_embedded_capacity.rb @@ -4,7 +4,7 @@ class AzurePowerBiEmbeddedCapacity < AzureGenericResource name 'azure_power_bi_embedded_capacity' desc 'Retrieves and verifies the settings of an Azure Power BI Embedded Capacity.' example <<-EXAMPLE - describe azure_power_bi_embedded_capacity(resource_group: 'migrate_vms', name: 'MigrateEvent01') do + describe azure_power_bi_embedded_capacity(resource_group: 'inspec-azure-rg', name: 'power-bi-inspec') do it { should exist } end EXAMPLE From dbe24f34708d10d2d1f90f3fa3928965a6744eeb Mon Sep 17 00:00:00 2001 From: Soumyodeep Karmakar Date: Wed, 2 Mar 2022 16:42:28 +0530 Subject: [PATCH 08/10] minor fix Signed-off-by: Soumyodeep Karmakar --- .../resources/azure_power_bi_embedded_capacities.md | 13 +++++++------ docs/resources/azure_power_bi_embedded_capacity.md | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/resources/azure_power_bi_embedded_capacities.md b/docs/resources/azure_power_bi_embedded_capacities.md index 14d5dddee..aa6d859a5 100644 --- a/docs/resources/azure_power_bi_embedded_capacities.md +++ b/docs/resources/azure_power_bi_embedded_capacities.md @@ -31,13 +31,13 @@ end ``` ## Parameters + | Name | Description | |----------------|----------------------------------------------------------------------------------| | account_name | The Azure Storage account name. | | dns_suffix | The DNS suffix for the Azure Data Lake Storage endpoint. | -The parameter set should be provided for a valid query: -- `account_name` +The below parameters are optional. - `account_name` and `dns_suffix` (optional) ## Properties @@ -87,14 +87,15 @@ This InSpec audit resource has the following special matchers. For a full list o ### exists ```ruby -# Should not exist if no Power BI Embedded Capacities are present in the project and in the resource group -describe azure_power_bi_embedded_capacities do - it { should_not exist } -end # Should exist if the filter returns at least one Migrate Assessment in the project and in the resource group describe azure_power_bi_embedded_capacities do it { should exist } end + +# Should not exist if no Power BI Embedded Capacities are present in the project and in the resource group +describe azure_power_bi_embedded_capacities do + it { should_not exist } +end ``` ## Azure Permissions diff --git a/docs/resources/azure_power_bi_embedded_capacity.md b/docs/resources/azure_power_bi_embedded_capacity.md index 689a7194b..d39571880 100644 --- a/docs/resources/azure_power_bi_embedded_capacity.md +++ b/docs/resources/azure_power_bi_embedded_capacity.md @@ -72,7 +72,7 @@ Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/p ```ruby describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do - its() { should eq 1.0 } + its('count') { should eq 1.0 } end ``` From 7d5abac5c6d00a0d26b015210b6601ddfa413adc Mon Sep 17 00:00:00 2001 From: Deepa Kumaraswamy Date: Fri, 11 Mar 2022 20:36:22 +0530 Subject: [PATCH 09/10] doc review Signed-off-by: Deepa Kumaraswamy --- .../azure_power_bi_embedded_capacities.md | 25 ++++++++----------- .../azure_power_bi_embedded_capacity.md | 14 ++++------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/docs/resources/azure_power_bi_embedded_capacities.md b/docs/resources/azure_power_bi_embedded_capacities.md index aa6d859a5..fae1c3328 100644 --- a/docs/resources/azure_power_bi_embedded_capacities.md +++ b/docs/resources/azure_power_bi_embedded_capacities.md @@ -3,16 +3,15 @@ title: About the azure_power_bi_embedded_capacities Resource platform: azure --- -# azure_power_bi_embedded_capacities +## azure_power_bi_embedded_capacities Use the `azure_power_bi_embedded_capacities` InSpec audit resource to test the properties related to all Azure Power BI Embedded Capacities within a project. ## Azure REST API version, Endpoint, and HTTP Client Parameters -This resource interacts with API versions supported by the resource provider. The `api_version` is defined as a resource parameter. -If not provided, the latest version is used. For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). +This resource interacts with API versions supported by the resource provider. The `api_version` is defined as a resource parameter. If not provided, the latest version is used. For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). -Unless defined, `azure_cloud` global endpoint and default values for the HTTP client is used. For more information, refer to the resource pack [README](../../README.md). +Unless defined, `azure_cloud` global endpoint and default values for the HTTP client are used. For more information, refer to the resource pack [README](../../README.md). ## Availability @@ -37,8 +36,7 @@ end | account_name | The Azure Storage account name. | | dns_suffix | The DNS suffix for the Azure Data Lake Storage endpoint. | -The below parameters are optional. -- `account_name` and `dns_suffix` (optional) +The following parameters are optional,`account_name` and `dns_suffix`. ## Properties @@ -46,19 +44,16 @@ The below parameters are optional. |--------------------|---------------------------------------------------------------|------------------| | ids | A list of PowerBI Dedicated resources. | `id` | | names | The names of all the PowerBI Dedicated resource. | `name` | -| locations | A list of all locations of all the PowerBI Dedicated resource.| `location` | +| locations | A location list of all the PowerBI Dedicated resource. | `location` | | modes | A list of all the capacity modes. | `mode` | -| provisioningStates | A list of all provisioning state. |`provisioningState`| +| provisioningStates | A list of all provisioning states. |`provisioningState`| | states | The current state of all PowerBI Dedicated resources. | `state` | | sku_names | The SKU name of the PowerBI Dedicated resource. | `sku_name` | | sku_tiers | The SKU tier of the PowerBI Dedicated resource. | `sku_tier` | | sku_capacities | The SKU capacities of the PowerBI Dedicated resource. | `sku_capacity` | -| administration_members | A collection of Dedicated capacity administrators. | `administration_members` | +| administration_members | A collection of dedicated capacity administrators. | `administration_members` | - - -* For information on how to use filter criteria on plural resources refer to [FilterTable usage](https://github.com/inspec/inspec/blob/master/dev-docs/filtertable-usage.md). -Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/list) for other properties available. +* For information on how to use filter criteria on plural resources refer to [FilterTable usage](https://github.com/inspec/inspec/blob/master/dev-docs/filtertable-usage.md). Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/list) for other properties available. ## Examples @@ -72,7 +67,7 @@ azure_power_bi_embedded_capacities.names.each do |name| end ``` -### Test to ensure Power BI Embedded Capacities where sku_capacities greater than 1 +### Test to ensure Power BI Embedded Capacities where sku_capacities greater than 1 ```ruby describe azure_power_bi_embedded_capacities.where(sku_capacity > 1 ) do @@ -100,4 +95,4 @@ end ## Azure Permissions -Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be set up with a `contributor` role on the subscription you wish to test. \ No newline at end of file +Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be set up with a `contributor` role on the subscription you wish to test. diff --git a/docs/resources/azure_power_bi_embedded_capacity.md b/docs/resources/azure_power_bi_embedded_capacity.md index d39571880..5b5c533b3 100644 --- a/docs/resources/azure_power_bi_embedded_capacity.md +++ b/docs/resources/azure_power_bi_embedded_capacity.md @@ -3,14 +3,13 @@ title: About the azure_power_bi_embedded_capacity Resource platform: azure --- -# azure_power_bi_embedded_capacity +## azure_power_bi_embedded_capacity Use the `azure_power_bi_embedded_capacity` InSpec audit resource to test the properties related to Azure Power BI Embedded Capacity. ## Azure REST API version, Endpoint, and HTTP Client Parameters -This resource interacts with API versions supported by the resource provider. The `api_version` is defined as a resource parameter. -If not provided, the latest version is used. For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). +This resource interacts with API versions supported by the resource provider. The `api_version` is defined as a resource parameter. If not provided, the latest version is used. For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). Unless defined, `azure_cloud` global endpoint and default values for the HTTP client are used. For more information, refer to the resource pack [README](../../README.md). @@ -22,7 +21,7 @@ This resource is available in the [InSpec Azure resource pack](https://github.co ## Syntax -`name` and `resource_group` is a required parameter. +`name` and `resource_group` are required parameters. ```ruby describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do @@ -43,9 +42,7 @@ end | name | Name of the Power BI Embedded Capacity to test. | | resource_group | Azure Resource Group. | -The parameter set should be provided for a valid query: - -- `name` and `account_name` +The parameter set for a valid query that should be provided are `name` and `account_name`. ## Properties @@ -61,7 +58,6 @@ The parameter set should be provided for a valid query: | tags | Key-value pairs of additional resource provisioning properties. | | type | The type of the PowerBI Dedicated resource. | - For properties applicable to all resources, such as `type`, `name`, `id`, and `properties`, refer to [`azure_generic_resource`](azure_generic_resource.md#properties). Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/get-details) for other properties available. @@ -95,4 +91,4 @@ end ## Azure Permissions -Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be set up with a `contributor` role on the subscription you wish to test. \ No newline at end of file +Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be set up with a `contributor` role on the subscription you wish to test. From 3b078e8682a99684f7853092141df0f5dcf51450 Mon Sep 17 00:00:00 2001 From: Ian Maddaus Date: Fri, 11 Mar 2022 10:42:28 -0500 Subject: [PATCH 10/10] Migrate docs Signed-off-by: Ian Maddaus --- .../azure_power_bi_embedded_capacities.md | 141 ++++++++++++++++++ .../azure_power_bi_embedded_capacity.md | 113 ++++++++++++++ .../azure_power_bi_embedded_capacities.md | 98 ------------ .../azure_power_bi_embedded_capacity.md | 94 ------------ 4 files changed, 254 insertions(+), 192 deletions(-) create mode 100644 docs-chef-io/content/inspec/resources/azure_power_bi_embedded_capacities.md create mode 100644 docs-chef-io/content/inspec/resources/azure_power_bi_embedded_capacity.md delete mode 100644 docs/resources/azure_power_bi_embedded_capacities.md delete mode 100644 docs/resources/azure_power_bi_embedded_capacity.md diff --git a/docs-chef-io/content/inspec/resources/azure_power_bi_embedded_capacities.md b/docs-chef-io/content/inspec/resources/azure_power_bi_embedded_capacities.md new file mode 100644 index 000000000..5f6c1bb74 --- /dev/null +++ b/docs-chef-io/content/inspec/resources/azure_power_bi_embedded_capacities.md @@ -0,0 +1,141 @@ ++++ +title = "azure_power_bi_embedded_capacities Resource" +platform = "azure" +draft = false +gh_repo = "inspec-azure" + +[menu.inspec] +title = "azure_power_bi_embedded_capacities" +identifier = "inspec/resources/azure/azure_power_bi_embedded_capacities Resource" +parent = "inspec/resources/azure" ++++ + +### azure_power_bi_embedded_capacities + +Use the `azure_power_bi_embedded_capacities` InSpec audit resource to test the properties related to all Azure Power BI Embedded Capacities within a project. + +## Azure REST API Version, Endpoint, and HTTP Client Parameters + +{{% inspec_azure_common_parameters %}} + +## Installation + +{{% inspec_azure_install %}} + +## Syntax + +An `azure_power_bi_embedded_capacities` resource block returns all Azure Power BI Embedded Capacities within a project. + +```ruby +describe azure_power_bi_embedded_capacities do + #... +end +``` + +## Parameters + +`account_name` +: The Azure Storage account name. + +`dns_suffix` +: The DNS suffix for the Azure Data Lake Storage endpoint. + +The following parameters are optional,`account_name` and `dns_suffix`. + +## Properties + +`ids` +: A list of PowerBI Dedicated resources. + +: **Field**: `id` + +`names` +: The names of all the PowerBI Dedicated resource. + +: **Field**: `name` + +`locations` +: A location list of all the PowerBI Dedicated resource. + +: **Field**: `location` + +`modes` +: A list of all the capacity modes. + +: **Field**: `mode` + +`provisioningStates` +: A list of all provisioning states. + +: **Field**: `provisioningState` + +`states` +: The current state of all PowerBI Dedicated resources. + +: **Field**: `state` + +`sku_names` +: The SKU name of the PowerBI Dedicated resource. + +: **Field**: `sku_name` + +`sku_tiers` +: The SKU tier of the PowerBI Dedicated resource. + +: **Field**: `sku_tier` + +`sku_capacities` +: The SKU capacities of the PowerBI Dedicated resource. + +: **Field**: `sku_capacity` + +`administration_members` +: A collection of dedicated capacity administrators. + +: **Field**: `administration_members` + +{{% inspec_filter_table %}} + +## Examples + +**Loop through Power BI Embedded Capacities by their names.** + +```ruby +azure_power_bi_embedded_capacities.names.each do |name| + describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: name) do + it { should exist } + end +end +``` + +**Test to ensure Power BI Embedded Capacities where sku_capacities greater than 1.** + +```ruby +describe azure_power_bi_embedded_capacities.where(sku_capacity > 1 ) do + it { should exist } +end +``` + +## Matchers + +{{% inspec_matchers_link %}} + +### exists + +```ruby +# Should exist if the filter returns at least one Migrate Assessment in the project and in the resource group + +describe azure_power_bi_embedded_capacities do + it { should exist } +end + +# Should not exist if no Power BI Embedded Capacities are present in the project and in the resource group + +describe azure_power_bi_embedded_capacities do + it { should_not exist } +end +``` + +## Azure Permissions + +{{% azure_permissions_service_principal role="contributor" %}} diff --git a/docs-chef-io/content/inspec/resources/azure_power_bi_embedded_capacity.md b/docs-chef-io/content/inspec/resources/azure_power_bi_embedded_capacity.md new file mode 100644 index 000000000..39d9e6c46 --- /dev/null +++ b/docs-chef-io/content/inspec/resources/azure_power_bi_embedded_capacity.md @@ -0,0 +1,113 @@ ++++ +title = "azure_power_bi_embedded_capacity Resource" +platform = "azure" +draft = false +gh_repo = "inspec-azure" + +[menu.inspec] +title = "azure_power_bi_embedded_capacity" +identifier = "inspec/resources/azure/azure_power_bi_embedded_capacity Resource" +parent = "inspec/resources/azure" ++++ + +### azure_power_bi_embedded_capacity + +Use the `azure_power_bi_embedded_capacity` InSpec audit resource to test the properties related to Azure Power BI Embedded Capacity. + +## Azure REST API Version, Endpoint, and HTTP Client Parameters + +{{% inspec_azure_common_parameters %}} + +## Installation + +{{% inspec_azure_install %}} + +## Syntax + +`name` and `resource_group` are required parameters. + +```ruby +describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do + it { should exist } +end +``` + +```ruby +describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do + it { should exist } +end +``` + +## Parameters + +`name` +: Name of the Power BI Embedded Capacity to test. + +`resource_group` +: Azure Resource Group. + +The parameter set for a valid query that should be provided are `name` and `account_name`. + +## Properties + +`id` +: An identifier that represents the PowerBI Dedicated resource. + +`location` +: Location of the PowerBI Dedicated resource. + +`name` +: The name of the PowerBI Dedicated resource. + +`properties.administration` +: A collection of Dedicated capacity administrators. + +`properties.mode` +: The capacity mode. + +`properties.state` +: The current state of PowerBI Dedicated resource. The state is to indicate more states outside of resource provisioning. + +`sku` +: The SKU of the PowerBI Dedicated resource. + +`tags` +: Key-value pairs of additional resource provisioning properties. + +`type` +: The type of the PowerBI Dedicated resource. + +For properties applicable to all resources, such as `type`, `name`, `id`, and `properties`, refer to [`azure_generic_resource`]({{< relref "azure_generic_resource.md#properties" >}}). + +Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/get-details) for other properties available. + +## Examples + +**Test that the Power BI Embedded Capacity.** + +```ruby +describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do + its('count') { should eq 1.0 } +end +``` + +## Matchers + +{{% inspec_matchers_link %}} + +### exists + +```ruby +# If the Power BI Embedded Capacity is found, it will exist +describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do + it { should exist } +end +# if the Power BI Embedded Capacity is not found, it will not exist +describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do + it { should_not exist } +end +``` + +## Azure Permissions + +{{% azure_permissions_service_principal role="contributor" %}} diff --git a/docs/resources/azure_power_bi_embedded_capacities.md b/docs/resources/azure_power_bi_embedded_capacities.md deleted file mode 100644 index fae1c3328..000000000 --- a/docs/resources/azure_power_bi_embedded_capacities.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: About the azure_power_bi_embedded_capacities Resource -platform: azure ---- - -## azure_power_bi_embedded_capacities - -Use the `azure_power_bi_embedded_capacities` InSpec audit resource to test the properties related to all Azure Power BI Embedded Capacities within a project. - -## Azure REST API version, Endpoint, and HTTP Client Parameters - -This resource interacts with API versions supported by the resource provider. The `api_version` is defined as a resource parameter. If not provided, the latest version is used. For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). - -Unless defined, `azure_cloud` global endpoint and default values for the HTTP client are used. For more information, refer to the resource pack [README](../../README.md). - -## Availability - -### Installation - -This resource is available in the [InSpec Azure resource pack](https://github.com/inspec/inspec-azure). For an example, `inspec.yml` file and how to set up your Azure credentials, refer to resource pack [README](../../README.md#Service-Principal). - -## Syntax - -An `azure_power_bi_embedded_capacities` resource block returns all Azure Power BI Embedded Capacities within a project. - -```ruby -describe azure_power_bi_embedded_capacities do - #... -end -``` - -## Parameters - -| Name | Description | -|----------------|----------------------------------------------------------------------------------| -| account_name | The Azure Storage account name. | -| dns_suffix | The DNS suffix for the Azure Data Lake Storage endpoint. | - -The following parameters are optional,`account_name` and `dns_suffix`. - -## Properties - -|Property | Description | Filter Criteria* | -|--------------------|---------------------------------------------------------------|------------------| -| ids | A list of PowerBI Dedicated resources. | `id` | -| names | The names of all the PowerBI Dedicated resource. | `name` | -| locations | A location list of all the PowerBI Dedicated resource. | `location` | -| modes | A list of all the capacity modes. | `mode` | -| provisioningStates | A list of all provisioning states. |`provisioningState`| -| states | The current state of all PowerBI Dedicated resources. | `state` | -| sku_names | The SKU name of the PowerBI Dedicated resource. | `sku_name` | -| sku_tiers | The SKU tier of the PowerBI Dedicated resource. | `sku_tier` | -| sku_capacities | The SKU capacities of the PowerBI Dedicated resource. | `sku_capacity` | -| administration_members | A collection of dedicated capacity administrators. | `administration_members` | - -* For information on how to use filter criteria on plural resources refer to [FilterTable usage](https://github.com/inspec/inspec/blob/master/dev-docs/filtertable-usage.md). Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/list) for other properties available. - -## Examples - -### Loop through Power BI Embedded Capacities by their names - -```ruby -azure_power_bi_embedded_capacities.names.each do |name| - describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: name) do - it { should exist } - end -end -``` - -### Test to ensure Power BI Embedded Capacities where sku_capacities greater than 1 - -```ruby -describe azure_power_bi_embedded_capacities.where(sku_capacity > 1 ) do - it { should exist } -end -``` - -## Matchers - -This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [Universal Matchers page](https://www.inspec.io/docs/reference/matchers/). - -### exists - -```ruby -# Should exist if the filter returns at least one Migrate Assessment in the project and in the resource group -describe azure_power_bi_embedded_capacities do - it { should exist } -end - -# Should not exist if no Power BI Embedded Capacities are present in the project and in the resource group -describe azure_power_bi_embedded_capacities do - it { should_not exist } -end -``` - -## Azure Permissions - -Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be set up with a `contributor` role on the subscription you wish to test. diff --git a/docs/resources/azure_power_bi_embedded_capacity.md b/docs/resources/azure_power_bi_embedded_capacity.md deleted file mode 100644 index 5b5c533b3..000000000 --- a/docs/resources/azure_power_bi_embedded_capacity.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: About the azure_power_bi_embedded_capacity Resource -platform: azure ---- - -## azure_power_bi_embedded_capacity - -Use the `azure_power_bi_embedded_capacity` InSpec audit resource to test the properties related to Azure Power BI Embedded Capacity. - -## Azure REST API version, Endpoint, and HTTP Client Parameters - -This resource interacts with API versions supported by the resource provider. The `api_version` is defined as a resource parameter. If not provided, the latest version is used. For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). - -Unless defined, `azure_cloud` global endpoint and default values for the HTTP client are used. For more information, refer to the resource pack [README](../../README.md). - -## Availability - -### Installation - -This resource is available in the [InSpec Azure resource pack](https://github.com/inspec/inspec-azure). For an example, `inspec.yml` file and how to set up your Azure credentials, refer to resource pack [README](../../README.md#Service-Principal). - -## Syntax - -`name` and `resource_group` are required parameters. - -```ruby -describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do - it { should exist } -end -``` - -```ruby -describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do - it { should exist } -end -``` - -## Parameters - -| Name | Description | -|----------------|----------------------------------------------------------------------------------| -| name | Name of the Power BI Embedded Capacity to test. | -| resource_group | Azure Resource Group. | - -The parameter set for a valid query that should be provided are `name` and `account_name`. - -## Properties - -| Property | Description | -|----------------------------|------------------------------------------------------------------| -| id | An identifier that represents the PowerBI Dedicated resource. | -| location | Location of the PowerBI Dedicated resource. | -| name | The name of the PowerBI Dedicated resource. | -| properties.administration | A collection of Dedicated capacity administrators. | -| properties.mode | The capacity mode. | -| properties.state | The current state of PowerBI Dedicated resource. The state is to indicate more states outside of resource provisioning.| -| sku | The SKU of the PowerBI Dedicated resource. | -| tags | Key-value pairs of additional resource provisioning properties. | -| type | The type of the PowerBI Dedicated resource. | - -For properties applicable to all resources, such as `type`, `name`, `id`, and `properties`, refer to [`azure_generic_resource`](azure_generic_resource.md#properties). - -Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/get-details) for other properties available. - -## Examples - -### Test that the Power BI Embedded Capacity - -```ruby -describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do - its('count') { should eq 1.0 } -end -``` - -## Matchers - -This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [Universal Matchers page](/inspec/matchers/). - -### exists - -```ruby -# If the Power BI Embedded Capacity is found, it will exist -describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do - it { should exist } -end -# if the Power BI Embedded Capacity is not found, it will not exist -describe azure_power_bi_embedded_capacity(resource_group: 'RESOURCE_GROUP', name: 'POWER_BI_EMBEDDED') do - it { should_not exist } -end -``` - -## Azure Permissions - -Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be set up with a `contributor` role on the subscription you wish to test.