Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Utilities] Updated utility references to new naming scheme #3471

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions utilities/pipelines/resourceDeployment/New-TemplateDeployment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ Optional. Maximum retry limit if the deployment fails. Default is 3.
Optional. Do not throw an exception if it failed. Still returns the error message though

.EXAMPLE
New-TemplateDeploymentInner -templateFilePath 'C:/KeyVault/main.json' -parameterFilePath 'C:/KeyVault/.test/parameters.json' -location 'WestEurope' -resourceGroupName 'aLegendaryRg'
New-TemplateDeploymentInner -templateFilePath 'C:/key-vault/vault/main.json' -parameterFilePath 'C:/key-vault/vault/.test/parameters.json' -location 'WestEurope' -resourceGroupName 'aLegendaryRg'

Deploy the main.json of the KeyVault module with the parameter file 'parameters.json' using the resource group 'aLegendaryRg' in location 'WestEurope'

.EXAMPLE
New-TemplateDeploymentInner -templateFilePath 'C:/KeyVault/main.bicep' -location 'WestEurope' -resourceGroupName 'aLegendaryRg'
New-TemplateDeploymentInner -templateFilePath 'C:/key-vault/vault/main.bicep' -location 'WestEurope' -resourceGroupName 'aLegendaryRg'

Deploy the main.bicep of the KeyVault module using the resource group 'aLegendaryRg' in location 'WestEurope'

.EXAMPLE
New-TemplateDeploymentInner -templateFilePath 'C:/ResourceGroup/main.json' -location 'WestEurope'
New-TemplateDeploymentInner -templateFilePath 'C:/resources/resource-group/main.json' -location 'WestEurope'

Deploy the main.json of the ResourceGroup module without a parameter file in location 'WestEurope'
#>
Expand Down Expand Up @@ -163,14 +163,16 @@ function New-TemplateDeploymentInner {
if ([String]::IsNullOrEmpty($deploymentNamePrefix)) {
$deploymentNamePrefix = 'templateDeployment-{0}' -f (Split-Path $templateFilePath -LeafBase)
}
if ($templateFilePath -match '.*(\\|\/)Microsoft.+') {

$modulesRegex = '.+[\\|\/]modules[\\|\/]'
if ($templateFilePath -match $modulesRegex) {
# If we can assume we're operating in a module structure, we can further fetch the provider namespace & resource type
$shortPathElem = (($templateFilePath -split 'Microsoft\.')[1] -replace '\\', '/') -split '/' # e.g., AppConfiguration, configurationStores, .test, common, main.test.bicep
$providerNamespace = $shortPathElem[0] # e.g., AppConfiguration
$providerNamespaceShort = ($providerNamespace -creplace '[^A-Z]').ToLower() # e.g., ac
$shortPathElem = (($templateFilePath -split $modulesRegex)[1] -replace '\\', '/') -split '/' # e.g., app-configuration, configuration-store, .test, common, main.test.bicep
$providerNamespace = $shortPathElem[0] # e.g., app-configuration
$providerNamespaceShort = ($providerNamespace -split '-' | ForEach-Object { $_[0] }) -join '' # e.g., ac

$resourceType = $shortPathElem[1] # e.g., configurationStores
$resourceTypeShort = ('{0}{1}' -f ($resourceType.ToLower())[0], ($resourceType -creplace '[^A-Z]')).ToLower() # e.g. cs
$resourceType = $shortPathElem[1] # e.g., configuration-store
$resourceTypeShort = ($resourceType -split '-' | ForEach-Object { $_[0] }) -join '' # e.g. cs

$testFolderShort = Split-Path (Split-Path $templateFilePath -Parent) -Leaf # e.g., common

Expand Down Expand Up @@ -362,7 +364,7 @@ Optional. ID of the subscription to deploy into. Mandatory if deploying into a s
Optional. Name of the management group to deploy into. Mandatory if deploying into a management group (management group level)

.PARAMETER additionalTags
Optional. Provde a Key Value Pair (Object) that will be appended to the Parameter file tags. Example: @{myKey = 'myValue',myKey2 = 'myValue2'}.
Optional. Provide a Key Value Pair (Object) that will be appended to the Parameter file tags. Example: @{myKey = 'myValue', myKey2 = 'myValue2'}.

.PARAMETER additionalParameters
Optional. Additional parameters you can provide with the deployment. E.g. @{ resourceGroupName = 'myResourceGroup' }
Expand All @@ -374,19 +376,19 @@ Optional. Maximum retry limit if the deployment fails. Default is 3.
Optional. Do not throw an exception if it failed. Still returns the error message though

.EXAMPLE
New-TemplateDeployment -templateFilePath 'C:/KeyVault/main.bicep' -parameterFilePath 'C:/KeyVault/.test/parameters.json' -location 'WestEurope' -resourceGroupName 'aLegendaryRg'
New-TemplateDeployment -templateFilePath 'C:/key-vault/vault/main.bicep' -parameterFilePath 'C:/key-vault/vault/.test/parameters.json' -location 'WestEurope' -resourceGroupName 'aLegendaryRg'

Deploy the main.bicep of the KeyVault module with the parameter file 'parameters.json' using the resource group 'aLegendaryRg' in location 'WestEurope'
Deploy the main.bicep of the 'key-vault/vault' module with the parameter file 'parameters.json' using the resource group 'aLegendaryRg' in location 'WestEurope'

.EXAMPLE
New-TemplateDeployment -templateFilePath 'C:/ResourceGroup/main.bicep' -location 'WestEurope'
New-TemplateDeployment -templateFilePath 'C:/resources/resource-group/main.bicep' -location 'WestEurope'

Deploy the main.bicep of the ResourceGroup module in location 'WestEurope' without a parameter file
Deploy the main.bicep of the 'resources/resource-group' module in location 'WestEurope' without a parameter file

.EXAMPLE
New-TemplateDeployment -templateFilePath 'C:/ResourceGroup/main.json' -parameterFilePath 'C:/ResourceGroup/.test/parameters.json' -location 'WestEurope'
New-TemplateDeployment -templateFilePath 'C:/resources/resource-group/main.json' -parameterFilePath 'C:/resources/resource-group/.test/parameters.json' -location 'WestEurope'

Deploy the main.json of the ResourceGroup module with the parameter file 'parameters.json' in location 'WestEurope'
Deploy the main.json of the 'resources/resource-group' module with the parameter file 'parameters.json' in location 'WestEurope'
#>
function New-TemplateDeployment {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ Optional. Name of the management group to deploy into. Mandatory if deploying in
Optional. Additional parameters you can provide with the deployment. E.g. @{ resourceGroupName = 'myResourceGroup' }

.EXAMPLE
Test-TemplateDeployment -templateFilePath 'C:/KeyVault/main.bicep' -parameterFilePath 'C:/KeyVault/.test/parameters.json' -location 'WestEurope' -resourceGroupName 'aLegendaryRg'
Test-TemplateDeployment -templateFilePath 'C:/key-vault/vault/main.bicep' -parameterFilePath 'C:/key-vault/vault/.test/parameters.json' -location 'WestEurope' -resourceGroupName 'aLegendaryRg'

Test the main.bicep of the KeyVault module with the parameter file 'parameters.json' using the resource group 'aLegendaryRg' in location 'WestEurope'

.EXAMPLE
Test-TemplateDeployment -templateFilePath 'C:/KeyVault/main.bicep' -location 'WestEurope' -resourceGroupName 'aLegendaryRg'
Test-TemplateDeployment -templateFilePath 'C:/key-vault/vault/main.bicep' -location 'WestEurope' -resourceGroupName 'aLegendaryRg'

Test the main.bicep of the KeyVault module using the resource group 'aLegendaryRg' in location 'WestEurope'

.EXAMPLE
Test-TemplateDeployment -templateFilePath 'C:/ResourceGroup/main.json' -parameterFilePath 'C:/ResourceGroup/.test/parameters.json' -location 'WestEurope'
Test-TemplateDeployment -templateFilePath 'C:/resources/resource-group/main.json' -parameterFilePath 'C:/resources/resource-group/.test/parameters.json' -location 'WestEurope'

Test the main.json of the ResourceGroup module with the parameter file 'parameters.json' in location 'WestEurope'
#>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@ Optional. Publish an absolute latest version.
Note: This version may include breaking changes and is not recommended for production environments

.EXAMPLE
Get-ModulesMissingFromPrivateBicepRegistry -TemplateFilePath 'C:\ResourceModules\modules\compute\virtual-machines\main.bicep' -BicepRegistryName 'adpsxxazacrx001' -BicepRegistryRgName 'artifacts-rg'
Get-ModulesMissingFromPrivateBicepRegistry -TemplateFilePath 'C:\ResourceModules\modules\compute\virtual-machine\main.bicep' -BicepRegistryName 'adpsxxazacrx001' -BicepRegistryRgName 'artifacts-rg'

Check if either the Virtual Machine module or any of its children (e.g. 'extension') is missing in the Container Registry 'adpsxxazacrx001' of Resource Group 'artifacts-rg'

Returns for example:
Name Value
---- -----
Version 0.4.0
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machines\extensions\main.bicep
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machine\extension\main.bicep
Version 0.4
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machines\extensions\main.bicep
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machine\extension\main.bicep
Version 0
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machines\extensions\main.bicep
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machine\extension\main.bicep
Version latest
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machines\extensions\main.bicep
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machine\extension\main.bicep
Version 0.6.0
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machines\main.bicep
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machine\main.bicep
Version 0.6
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machines\main.bicep
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machine\main.bicep
Version 0
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machines\main.bicep
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machine\main.bicep
Version latest
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machines\main.bicep
TemplateFilePath C:\ResourceModules\modules\compute\virtual-machine\main.bicep
#>
function Get-ModulesMissingFromPrivateBicepRegistry {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,45 @@ Optional. Publish an absolute latest version.
Note: This version may include breaking changes and is not recommended for production environments

.EXAMPLE
Get-ModulesMissingFromTemplateSpecsRG -TemplateFilePath 'C:\ResourceModules\modules\key-vault\vaults\main.bicep' -TemplateSpecsRGName 'artifacts-rg'
Get-ModulesMissingFromTemplateSpecsRG -TemplateFilePath 'C:\ResourceModules\modules\key-vault\vault\main.bicep' -TemplateSpecsRGName 'artifacts-rg'

Check if either the Key Vault module or any of its children (e.g. 'secret') is missing in the Resource Group 'artifacts-rg'

Returns for example:
Name Value
---- -----
Version 0.4.0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\access-policies\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\access-policy\main.bicep
Version 0.4
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\access-policies\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\access-policy\main.bicep
Version 0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\access-policies\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\access-policy\main.bicep
Version latest
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\access-policies\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\access-policy\main.bicep
Version 0.4.0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\keys\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\key\main.bicep
Version 0.4
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\keys\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\key\main.bicep
Version 0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\keys\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\key\main.bicep
Version latest
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\keys\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\key\main.bicep
Version 0.4.0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\secrets\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\secret\main.bicep
Version 0.4
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\secrets\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\secret\main.bicep
Version 0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\secrets\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\secret\main.bicep
Version latest
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\secrets\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\secret\main.bicep
Version 0.5.0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\main.bicep
Version 0.5
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\main.bicep
Version 0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\main.bicep
Version latest
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\main.bicep
#>
function Get-ModulesMissingFromTemplateSpecsRG {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ Example: 'Artifacts'.
Optional. The bearer token to use to authenticate the request. If not provided it MUST be existing in your environment as `$env:TOKEN`

.EXAMPLE
Get-ModulesMissingFromUniversalArtifactsFeed -TemplateFilePath 'C:\modules\key-vault\vaults\main.bicep' -vstsOrganizationUri 'https://dev.azure.com/fabrikam' -VstsProject 'IaC' -VstsFeedName 'Artifacts'
Get-ModulesMissingFromUniversalArtifactsFeed -TemplateFilePath 'C:\modules\key-vault\vault\main.bicep' -vstsOrganizationUri 'https://dev.azure.com/fabrikam' -VstsProject 'IaC' -VstsFeedName 'Artifacts'

Check if either the Key Vault module or any of its children (e.g. 'secret') is missing in artifacts feed 'Artifacts' of Azure DevOps project 'https://dev.azure.com/fabrikam/IaC'

Returns for example:
Name Value
---- -----
Version 0.4.0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\access-policies\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\access-policy\main.bicep
Version 0.4.0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\keys\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\key\main.bicep
Version 0.4.0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\secrets\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\secret\main.bicep
Version 0.5.0
TemplateFilePath C:\ResourceModules\modules\key-vault\vaults\main.bicep
TemplateFilePath C:\ResourceModules\modules\key-vault\vault\main.bicep
#>
function Get-ModulesMissingFromUniversalArtifactsFeed {

Expand Down
Loading