├── .gitignore ├── unit-tests ├── Min-And-Max-Value-Are-Numbers │ ├── Fail │ │ ├── Missing-Max.should.be.txt │ │ ├── Missing-Min.should.be.txt │ │ ├── Max-Is-Not-Int.should.be.txt │ │ ├── Min-Is-Not-Int.should.be.txt │ │ ├── Missing-Max.json │ │ ├── Missing-Min.json │ │ ├── Min-Is-Not-Int.json │ │ └── Max-Is-Not-Int.json │ ├── Min-And-Max-Value-Are-Numbers.tests.ps1 │ └── Pass │ │ └── Min-And-Max-Are-Present.json ├── DeploymentTemplate-Schema-Is-Correct │ ├── Fail │ │ ├── BadSchema.should.be.txt │ │ ├── BadSchema.json │ │ ├── NoSchema-But-Resources.json │ │ ├── BadSchema.should.be.ps1 │ │ └── NestedTemplate-Without-Schema.json │ ├── Pass │ │ ├── MarketPlaceSample.path.txt │ │ ├── 2015-01-01.json │ │ ├── 2019-04-01.json │ │ ├── 2019-08-01-tenantDeploymentTemplate.json │ │ ├── 2018-05-01-subscriptionDeploymentTemplate.json │ │ └── 2019-08-01-managementGroupDeploymentTemplate.json │ └── DeploymentTemplate-Schema-Is-Correct.tests.ps1 ├── adminUsername-Should-Not-Be-A-Literal │ ├── Pass │ │ ├── empty.path.txt │ │ ├── MarketplaceSample.path.txt │ │ └── ExpressionValue.json │ ├── Fail │ │ ├── Literal-Admin-Username.should.be.txt │ │ ├── Literal-Admin-Username.json │ │ ├── Literal-Admin-Username-SymbolicName.json │ │ ├── Literal-Variable-Username.json │ │ ├── Literal-Variable-Property-Username.json │ │ └── Literal-Admin-AdminLogin.json │ └── adminUsername-Should-Not-Be-A-Literal.tests.ps1 ├── _arm-ttk-module │ ├── Bad.json │ ├── Sample.jsonc │ ├── README.md │ ├── ExpandVariables.json │ ├── JSONC.module.tests.ps1 │ ├── BadJSON.tests.ps1 │ └── Test-AzTemplates.tests.ps1 ├── DependsOn-Best-Practices │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── DependsOn-Has-CopyIndex.json │ │ ├── DependsOn-Has-ResourceId.json │ │ └── dependson-nested-if.json │ ├── DependsOn-Best-Practices.tests.ps1 │ └── Fail │ │ ├── DependsOn-Has-If.json │ │ └── DependsOn-Starts-With-Concat.json ├── DeploymentParameters-Should-Have-Schema │ ├── Fail │ │ ├── BadSchema.parameters.should.be.txt │ │ └── BadSchema.parameters.json │ ├── Pass │ │ ├── keyvalue.parameters.json │ │ ├── MarketplaceSample.path.txt │ │ └── 2015-01-01.parameters.json │ └── DeploymentParameters-Should-Have-Schema.tests.ps1 ├── DeploymentParameters-Should-Have-Value │ ├── Pass │ │ ├── keyvalue.parameters.json │ │ ├── MarketplaceSample.path.txt │ │ └── HasValid.parameters.json │ ├── Fail │ │ ├── InvalidKeyVaultId.parameters.should.be.txt │ │ ├── BadSecretNameKeyVault.parameters.should.be.txt │ │ ├── InvalidParameterObject.parameters.should.be.txt │ │ ├── MissingKeyVaultId.parameters.should.be.txt │ │ ├── MissingSecretNameKeyVault.parameters.should.be.txt │ │ ├── InvalidParameterObjectReference.parameters.should.be.txt │ │ ├── InvalidParameterObject.parameters.json │ │ ├── MissingKeyVaultId.parameters.json │ │ ├── InvalidKeyVaultId.parameters.json │ │ ├── MissingSecretNameKeyVault.parameters.json │ │ └── BadSecretNameKeyVault.parameters.json │ └── DeploymentParameters-Should-Property.tests.ps1 ├── Handler-Must-Be-Correct │ ├── Pass │ │ └── MarketplaceSample.path.txt │ ├── Handler-Must-Be-Correct.tests.ps1 │ └── Fail │ │ ├── InvalidHandler │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json │ │ └── MissingHandler │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json ├── Variables-Must-Be-Referenced │ ├── Fail │ │ ├── Unreferenced-Variable.should.be.txt │ │ ├── Unreferenced-Variable.json │ │ ├── dollar.json │ │ ├── Unreferenced-Copy-Variable.json │ │ └── Unreferenced-Variable-Copy-Property.json │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── sharp.json │ │ ├── dollar.json │ │ ├── bicep-generated-var.json │ │ ├── Variable-List-Value.json │ │ └── Variable-Copy.json │ └── Variables-Must-Be-Referenced.tests.ps1 ├── Controls-In-Outputs-Must-Exist │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ └── OutputtingObject │ │ │ └── azuredeploy.json │ ├── Controls-In-Outputs-Must-Exist.tests.ps1 │ └── Fail │ │ ├── Missing-Step │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json │ │ ├── Missing-ControlName │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json │ │ └── Missing-ElementName │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json ├── DeploymentParameters-Should-Have-Parameters │ ├── Pass │ │ ├── keyvalue.parameters.json │ │ └── MarketplaceSample.path.txt │ ├── Fail │ │ ├── NotExist.parameters.should.be.txt │ │ └── NotExist.parameters.json │ └── DeploymentParameters-Should-Have-Parameters.tests.ps1 ├── Location-Should-Be-In-Outputs │ ├── Pass │ │ └── MarketplaceSample.path.txt │ ├── Location-Should-Be-In-Outputs.tests.ps1 │ └── Fail │ │ ├── Location-Missing │ │ ├── createUiDefinition.json │ │ └── azuredeploy.json │ │ └── Location-Invalid │ │ ├── createUiDefinition.json │ │ └── azuredeploy.json ├── Parameters-Must-Be-Referenced │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── emptyparameters.json │ │ ├── SkipMe.json │ │ ├── Used-Directly-In-Variables.json │ │ ├── azuredeploy.json │ │ ├── param-name-whitespace.json │ │ ├── Different-Case-In-Reference.json │ │ └── Used-In-Concat.json │ ├── Parameters-Must-Be-Referenced.tests.ps1 │ └── Fail │ │ ├── NotUsed.json │ │ └── not-a-valid-expression.json ├── Password-params-must-be-secure │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── emptyparameters.json │ │ ├── SkipMe.json │ │ ├── param-name-whitespace.json │ │ ├── no-password-params.json │ │ └── secured.json │ ├── Password-params-must-be-secure.tests.ps1 │ └── Fail │ │ ├── object-type.json │ │ ├── string-type.json │ │ └── multiple.json ├── Resources-Should-Have-Location │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ └── global.json │ ├── Resources-Should-Have-Location.tests.ps1 │ └── Fail │ │ └── hardcoded.json ├── Tooltips-Should-Be-Present │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── apiControlRequestBody │ │ │ └── azuredeploy.json │ │ ├── InfoboxTooltipNotRequired │ │ │ ├── azuredeploy.json │ │ │ └── createUiDefinition.json │ │ ├── TextBlockTooltipNotRequired │ │ │ ├── azuredeploy.json │ │ │ └── createUiDefinition.json │ │ ├── EditableGridTooltipNotRequired │ │ │ ├── azuredeploy.json │ │ │ └── createUiDefinition.json │ │ └── SectionTooltipNotRequired │ │ │ ├── createUiDefinition.json │ │ │ └── azuredeploy.json │ ├── Tooltips-Should-Be-Present.tests.ps1 │ └── Fail │ │ └── MissingTooltip │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json ├── VM-Size-Should-Be-A-Parameter │ ├── Pass │ │ └── MarketplaceSample.path.txt │ ├── VM-Size-Should-Be-A-Parameter.tests.ps1 │ └── Fail │ │ └── Fixed-VM-Size.json ├── VMSizes-Must-Match-Template │ ├── Pass │ │ └── MarketplaceSample.path.txt │ └── VMSizes-Must-Match-Template.tests.ps1 ├── DeploymentParameters-Should-Have-ContentVersion │ ├── Fail │ │ ├── NotString.parameters.should.be.txt │ │ ├── Missing.parameters.should.be.txt │ │ ├── Missing.parameters.json │ │ └── NotString.parameters.json │ ├── Pass │ │ ├── keyvalue.parameters.json │ │ └── MarketplaceSample.path.txt │ └── DeploymentParameters-Should-Have-ContentVersion.tests.ps1 ├── HideExisting-Must-Be-Correctly-Handled │ ├── Fail │ │ ├── Missing-NewOrExisting.should.be.txt │ │ ├── Missing-ResourceGroup.should.be.txt │ │ ├── explicit-false-missing-neworexisting.txt │ │ ├── Missing-Output.json │ │ ├── Missing-NewOrExisting.json │ │ └── Missing-ResourceGroup.json │ ├── Pass │ │ └── MarketplaceSample.path.txt │ └── HideExisting-Must-Be-Correctly-Handled.tests.ps1 ├── Location-Should-Not-Be-Hardcoded │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── emptyparameters.json │ │ ├── global │ │ │ └── azuredeploy.json │ │ ├── deployment.location │ │ │ └── azuredeploy.json │ │ ├── no-parameters │ │ │ └── azuredeploy.json │ │ └── Location-In-Parameters.json │ ├── Location-Should-Not-Be-Hardcoded.tests.ps1 │ └── Fail │ │ ├── mainTemplate.json │ │ ├── nested-template.json │ │ └── no-parameters.json ├── Secure-Params-In-Nested-Deployments │ ├── Pass │ │ └── MarketplaceSample.path.txt │ └── Secure-Params-In-Nested-Deployments.tests.ps1 ├── Template-Should-Not-Contain-Blanks │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── azuredeploy.json │ │ └── Blanks-In-Config-AppSettings.json │ ├── Template-Should-Not-Contain-Blanks.tests.ps1 │ └── Fail │ │ ├── null-var.json │ │ ├── empty-array.json │ │ ├── empty-object.json │ │ ├── empty-string.json │ │ └── Blanks-In-Config.json ├── Usernames-Should-Not-Have-A-Default │ ├── Pass │ │ └── MarketplaceSample.path.txt │ ├── Usernames-Should-Not-Have-A-Default.tests.ps1 │ └── Fail │ │ └── DefaultUsername │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json ├── CreateUIDefinition-Must-Not-Have-Blanks │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ └── CreateUIDefinition-With-Blank-Basics │ │ │ ├── azuredeploy.json │ │ │ └── createUiDefinition.json │ ├── CreateUIDefinition-Must-Not-Have-Blanks.tests.ps1 │ └── Fail │ │ ├── CreateUIDefinition-With-Blanks │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json │ │ ├── CreateUIDefinition-With-EmptyArray │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json │ │ └── CreateUIDefinition-With-EmptyObject │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json ├── CreateUIDefinition-Should-Have-Schema │ ├── Pass │ │ └── MarketplaceSample.path.txt │ └── CreateUIDefinition-Should-Have-Schema.tests.ps1 ├── Deployment-Resources-Must-Not-Be-Debug │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── DebugSettingsOmit.json │ │ └── DebugSettingsNone.json │ ├── Deployment-Resources-Must-Not-Be-Debug.tests.ps1 │ └── Fail │ │ ├── DebugSettingRequest.json │ │ ├── DebugSettingResponse.json │ │ └── DebugSettingRequestResponse.json ├── IDs-Should-Be-Derived-From-ResourceIDs │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── IDs-In-AppSettings.json │ │ ├── IDs-In-KeyVault.json │ │ └── documentdb-sqldatabases-that-contains-resource-id-should-pass.json │ ├── IDs-Should-Be-Derived-From-ResourceIDs.tests.ps1 │ └── Fail │ │ ├── bool.json │ │ ├── int.json │ │ ├── literal.json │ │ ├── whitespace.json │ │ ├── empty-string.json │ │ ├── concat.json │ │ └── documentdb-sqldatabases-that-contains-invalid-id-property-should-fail.json ├── URIs-Should-Be-Properly-Constructed │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ └── Concat-in-URL.json │ ├── URIs-Should-Be-Properly-Constructed.tests.ps1 │ └── Fail │ │ ├── URI-Using-Concat.json │ │ └── URI-Using-Format.json ├── Virtual-Machines-Should-Not-Be-Preview │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ └── virtualmachinescalesets.json │ ├── Virtual-Machines-Should-Not-Be-Preview.tests.ps1 │ └── Fail │ │ ├── Latest-Preview2.json │ │ ├── Latest-Preview-offer.json │ │ ├── Latest-Preview-sku.json │ │ ├── Latest-Preview-version.json │ │ └── StorageProfile-In-Variable.json ├── providers_apiVersions-Is-Not-Permitted │ ├── Fail │ │ ├── Uses-Providers-ApiVersion.should.be.txt │ │ └── Uses-Providers-ApiVersion.json │ ├── Pass │ │ └── MarketplaceSample.path.txt │ └── providers_apiVersions-Is-Not-Permitted.tests.ps1 ├── Allowed-Values-Should-Actually-Be-Allowed │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── ValueAllowed │ │ │ ├── README.md │ │ │ └── azuredeploy.json │ │ ├── MultiSelectAllowed │ │ │ ├── README.md │ │ │ └── azuredeploy.json │ │ ├── ValueAllowedInSteps │ │ │ ├── README.md │ │ │ └── azuredeploy.json │ │ ├── ValueAllowedInStepsSection │ │ │ ├── README.md │ │ │ └── azuredeploy.json │ │ ├── SkuAllowed │ │ │ └── AzureDeploy.json │ │ └── LocationValueAllowed │ │ │ └── mainTemplate.json │ ├── Fail │ │ ├── OutputMismatch │ │ │ ├── README.md │ │ │ └── azuredeploy.json │ │ ├── MultiSelectWithBadValue │ │ │ ├── README.md │ │ │ └── azuredeploy.json │ │ ├── DefaultValueNotAllowed │ │ │ └── azuredeploy.json │ │ ├── LocationValueNotAllowed │ │ │ └── mainTemplate.json │ │ └── ValueNotAllowed │ │ │ └── azuredeploy.json │ └── Allowed-Values-Should-Actually-Be-Allowed.tests.ps1 ├── Credential-Confirmation-Should-Not-Be-Hidden │ ├── Pass │ │ └── MarketplaceSample.path.txt │ ├── Credential-Confirmation-Should-Not-Be-Hidden.tests.ps1 │ └── Fail │ │ ├── PasswordBox │ │ └── azuredeploy.json │ │ └── CredentialsCombo │ │ └── azuredeploy.json ├── ManagedIdentityExtension-must-not-be-used │ ├── Pass │ │ └── MarketplaceSample.path.txt │ └── ManagedIdentityExtension-must-not-be-used.tests.ps1 ├── Secure-String-Parameters-Cannot-Have-Default │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── Blank-As-Default.json │ │ ├── NewGuid-As-Default.json │ │ └── NewGuid-With-Concat.json │ ├── Secure-String-Parameters-Cannot-Have-Default.tests.ps1 │ └── Fail │ │ └── Hardcoded-Value.json ├── Common │ └── Pass │ │ ├── 100-marketplace-sample │ │ ├── scripts │ │ │ └── FileToBeCopied.txt │ │ ├── README.md │ │ └── azuredeploy.parameters.json │ │ └── empty │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json ├── DeploymentTemplate-Must-Not-Contain-Hardcoded-Uri │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ └── Uri-In-Parameters.json │ ├── DeploymentTemplate-Must-Not-Contain-Hardcoded-Uri.tests.ps1 │ └── Fail │ │ ├── Hardcoded-Uri.json │ │ ├── Hardcoded-Full-Uri.json │ │ ├── Hardcoded-Uri-In-Uri.json │ │ └── Hardcoded-Uri-In-Concat.json ├── Dynamic-Variable-References-Should-Not-Use-Concat │ ├── Pass │ │ └── MarketplaceSample.path.txt │ ├── Dynamic-Variable-References-Should-Not-Use-Concat.tests.ps1 │ └── Fail │ │ └── Dynamic-Concat-Parameter.json ├── Outputs-Must-Be-Present-In-Template-Parameters │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── OutputCorrectType │ │ │ └── azureDeploy.json │ │ └── type-mismatch-int │ │ │ └── azureDeploy.json │ ├── Outputs-Must-Be-Present-In-Template-Parameters.tests.ps1 │ ├── Fail │ │ └── MissingOutput │ │ │ └── azuredeploy.json │ └── Warn │ │ └── OutputIncorrectType │ │ └── azureDeploy.json ├── CommandToExecute-Must-Use-ProtectedSettings-For-Secrets │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── list-function.json │ │ └── list-function-SymbolicName.json │ ├── CommandToExecute-Must-Use-ProtectedSettings-For-Secrets.tests.ps1 │ └── Fail │ │ ├── ListKeys.json │ │ ├── List.json │ │ └── UnsecuredParameter.json ├── Password-Textboxes-Must-Be-Used-For-Password-Parameters │ ├── Pass │ │ └── MarketplaceSample.path.txt │ ├── Password-Textboxes-Must-Be-Used-For-Password-Parameters.tests.ps1 │ └── Fail │ │ └── NotSecureString │ │ ├── azuredeploy.json │ │ └── createUiDefinition.json ├── Parameters-Without-Default-Must-Exist-In-CreateUIDefinition │ ├── Pass │ │ ├── MarketplaceSample.path.txt │ │ ├── emptyString │ │ │ ├── mainTemplate.json │ │ │ └── createUiDefinition.json │ │ └── nestedParameter │ │ │ └── CreateUIDefinition.json │ ├── Parameters-Without-Default-Must-Exist-In-CreateUIDefinition.tests.ps1 │ └── Fail │ │ └── MissingCreateUIParameter │ │ ├── createUiDefinition.json │ │ └── azuredeploy.json ├── artifacts-parameter │ ├── artifacts-parameter.tests.ps1 │ ├── Fail │ │ ├── nested-missing-sas.json │ │ ├── missing-sas │ │ │ └── mainTemplate.json │ │ ├── nested-wrong-type.json │ │ ├── wrong-type │ │ │ └── mainTemplate.json │ │ ├── missing-defaults │ │ │ └── mainTemplate.json │ │ ├── nested-with-defaults.json │ │ └── wrong-defaults │ │ │ └── mainTemplate.json │ └── Pass │ │ ├── nested-template.json │ │ ├── deployment-function │ │ └── mainTemplate.json │ │ └── raw-repo-path │ │ └── mainTemplate.json ├── JSONFiles-Should-Be-Valid │ └── JSONFiles-Should-Be-Valid.tests.ps1 ├── Textboxes-Are-Well-Formed │ ├── Textboxes-Are-Well-Formed.tests.ps1 │ ├── Fail │ │ ├── Textboxes-Without-Regex │ │ │ ├── azuredeploy.json │ │ │ └── createUiDefinition.json │ │ ├── Textboxes-With-Invalid-Regex │ │ │ └── azuredeploy.json │ │ ├── Textboxes-With-Invalid-Regex-Validations │ │ │ └── azuredeploy.json │ │ └── Textboxes-Without-Constrains-ValidationMessage │ │ │ └── azuredeploy.json │ └── Pass │ │ ├── Textboxes-With-Constrains-Regex │ │ └── azuredeploy.json │ │ ├── Textboxes-With-Constrains-Validations │ │ └── azuredeploy.json │ │ ├── Textboxes-With-Length-Constrains-Regex │ │ └── azuredeploy.json │ │ └── Textboxes-Without-Length-Constrains-Regex │ │ └── azuredeploy.json ├── ResourceIds-should-not-contain │ ├── ResourceIds-should-not-contain.tests.ps1 │ ├── Fail │ │ ├── concat.json │ │ ├── extensionResourceId.json │ │ ├── tenantResourceId.json │ │ ├── list-concat.json │ │ ├── resourcegroup-function.json │ │ ├── format.json │ │ ├── list-nested.json │ │ ├── multi-line.json │ │ ├── subscription-function.json │ │ ├── subscriptionResourceId.json │ │ ├── reference-concat.json │ │ └── reference-nested.json │ └── Pass │ │ └── azuredeploy.json ├── Validations-Must-Have-Message │ ├── Validations-Must-Have-Message.tests.ps1 │ ├── Fail │ │ └── Validations-Without-Message │ │ │ └── azuredeploy.json │ └── Pass │ │ └── Validation-With-Message │ │ └── azuredeploy.json ├── apiversions-should-be-recent │ ├── apiversions-should-be-recent.tests.ps1 │ ├── Pass │ │ ├── PreviewOnlyApi.json │ │ ├── Nested-API-Version.json │ │ ├── NonPreviewVersionWhereSamePreviewDateExists.json │ │ └── old-apiVersion-skipped.json │ └── Fail │ │ ├── preview-when-newer-is-available.json │ │ ├── not-a-string.json │ │ ├── old-apiVersion.json │ │ └── api-version-is-an-expression.json ├── Outputs-Must-Not-Contain-Secrets │ ├── Outputs-Must-Not-Contain-Secrets.tests.ps1 │ ├── Fail │ │ ├── Outputs-Cannot-Echo-Lists.json │ │ ├── list-only.json │ │ ├── Outputs-Cannot-Echo-ListKeys-With-Concat.json │ │ ├── Outputs-Cannot-Contain-Strings-Named-Password.json │ │ ├── Outputs-Cannot-Echo-ListKeys-In-Secret-Object.json │ │ ├── Outputs-Cannot-Contain-SecureString-Parameters.json │ │ ├── Outputs-Cannot-Contain-SecureString-Parameters-Trimmed.json │ │ └── Outputs-Cannot-Contain-SecureObject-Parameters.json │ └── Pass │ │ ├── Outputs-Can-Contain-Custom-List-Function.json │ │ └── Outputs-Can-Contain-Incomplete-Expression-References.json ├── PasswordBoxes-Must-Have-Min-Length │ ├── PasswordBoxes-Must-Have-Min-Length.tests.ps1 │ ├── Pass │ │ ├── No-Regex-Constraint.json │ │ └── Has-Complex-Constraint2.json │ └── Fail │ │ └── No-Min-Constraint.json ├── Resources-Should-Not-Be-Ambiguous │ ├── Resources-Should-Not-Be-Ambiguous.tests.ps1 │ └── Pass │ │ ├── SimpleResourceID.json │ │ ├── ResourceTypeFirstParameter (fail test).json │ │ ├── TrailingSlash (fail test).json │ │ ├── topLevelChild.json │ │ ├── top-level-child-expression.json │ │ └── NestedResourceType.json ├── Parameter-Types-Should-Be-Consistent │ └── Parameter-Types-Should-Be-Consistent.tests.ps1 ├── adminPassword-Should-Not-Be-A-Literal │ ├── adminPassword-Should-Not-Be-A-Literal.tests.ps1 │ ├── Pass │ │ └── ExpressionValue.json │ └── Fail │ │ └── Literal-Admin-AdminPassword.json ├── cache │ └── README.md ├── apiVersions-Should-Be-Recent-In-Reference-Functions │ ├── apiVersions-Should-Be-Recent-In-Reference-Functions.tests.ps1 │ ├── Fail │ │ ├── old-apiVersion.json │ │ ├── old-apiVersion-in-List.json │ │ ├── old-apiVersion-in-ListKeys.json │ │ ├── old-apiVersion-FullReference.json │ │ ├── old-apiVersion-NestedResource.json │ │ ├── old-apiVersion-in-ListAccountSas.json │ │ └── preview-apiVersion-ReferencedByVariable.json │ └── Pass │ │ ├── NoApiVersion.json │ │ ├── latestStableApiOlderThan2Years.json │ │ ├── NonPreviewVersionWhereSamePreviewDateExists.json │ │ └── bicep.json └── Secure-String-Parameters-Cannot-Have-Default.json ├── arm-ttk ├── GitHubWorkflow │ ├── Jobs │ │ ├── RunTTK.psd1 │ │ ├── TestPowerShellOnLinux.psd1 │ │ └── UpdateTTKCache.psd1 │ └── Steps │ │ ├── RunTTK.ps1 │ │ ├── CheckoutTTK.psd1 │ │ ├── InstallPester.ps1 │ │ └── UpdateTTKCache.psd1 ├── Test-AzTemplate.cmd ├── arm-ttk.psd1 ├── ttk.SampleWorkflow.PSDevOps.ps1 ├── AzRMTester.psd1 ├── Regex │ └── ARM │ │ ├── BracketOrQuote.regex.txt │ │ └── API_Version.regex.txt ├── ttk.test.workflow.psdevops.ps1 ├── Test-AzTemplate.sh ├── Update-TTKCache.ps1 ├── cache │ ├── AllEnvironments.init.cache.ps1 │ ├── AllImages.init.cache.ps1 │ └── README.md ├── testcases │ ├── deploymentTemplate │ │ ├── ManagedIdentityExtension-must-not-be-used.test.ps1 │ │ ├── providers_apiVersions-Is-Not-Permitted.test.ps1 │ │ └── Resources-Should-Have-Location.test.ps1 │ ├── AllFiles │ │ └── JSONFiles-Should-Be-Valid.test.ps1 │ ├── deploymentParameters │ │ └── DeploymentParameters-Should-Have-Parameters.test.ps1 │ └── CreateUIDefinition │ │ └── Usernames-Should-Not-Have-A-Default.test.ps1 └── SampleWorkflow.yml └── CODE_OF_CONDUCT.md /.gitignore: -------------------------------------------------------------------------------- 1 | bugs/* 2 | *.suo 3 | .vs/ 4 | .history/ 5 | *.zip 6 | -------------------------------------------------------------------------------- /unit-tests/Min-And-Max-Value-Are-Numbers/Fail/Missing-Max.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameter.Missing.Max -------------------------------------------------------------------------------- /unit-tests/Min-And-Max-Value-Are-Numbers/Fail/Missing-Min.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameter.Missing.Min -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/Fail/BadSchema.should.be.txt: -------------------------------------------------------------------------------- 1 | Template.Bad.Schema -------------------------------------------------------------------------------- /unit-tests/Min-And-Max-Value-Are-Numbers/Fail/Max-Is-Not-Int.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameter.Max.Not.Int -------------------------------------------------------------------------------- /unit-tests/Min-And-Max-Value-Are-Numbers/Fail/Min-Is-Not-Int.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameter.Min.Not.Int -------------------------------------------------------------------------------- /unit-tests/adminUsername-Should-Not-Be-A-Literal/Pass/empty.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\empty 2 | -------------------------------------------------------------------------------- /unit-tests/_arm-ttk-module/Bad.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "notgood":"json" 3 | "becauseitmisses":"acomma" 4 | }] -------------------------------------------------------------------------------- /unit-tests/DependsOn-Best-Practices/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Schema/Fail/BadSchema.parameters.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameters.Bad.Schema -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Schema/Pass/keyvalue.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "key1": "value1" 3 | } -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Pass/keyvalue.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "key1": "value1" 3 | } -------------------------------------------------------------------------------- /unit-tests/Handler-Must-Be-Correct/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Variables-Must-Be-Referenced/Fail/Unreferenced-Variable.should.be.txt: -------------------------------------------------------------------------------- 1 | Variables.Must.Be.Referenced 2 | -------------------------------------------------------------------------------- /unit-tests/Controls-In-Outputs-Must-Exist/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Parameters/Pass/keyvalue.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "key1": "value1" 3 | } -------------------------------------------------------------------------------- /unit-tests/Location-Should-Be-In-Outputs/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Parameters-Must-Be-Referenced/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Password-params-must-be-secure/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Resources-Should-Have-Location/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/VM-Size-Should-Be-A-Parameter/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/VMSizes-Must-Match-Template/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Variables-Must-Be-Referenced/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-ContentVersion/Fail/NotString.parameters.should.be.txt: -------------------------------------------------------------------------------- 1 | ContentVersion.Not.String -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-ContentVersion/Pass/keyvalue.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "key1": "value1" 3 | } -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Parameters/Fail/NotExist.parameters.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameters.Missing.Parameters -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/Pass/MarketPlaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample -------------------------------------------------------------------------------- /unit-tests/HideExisting-Must-Be-Correctly-Handled/Fail/Missing-NewOrExisting.should.be.txt: -------------------------------------------------------------------------------- 1 | Missing.Output.NewOrExisting 2 | -------------------------------------------------------------------------------- /unit-tests/Location-Should-Not-Be-Hardcoded/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Secure-Params-In-Nested-Deployments/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Template-Should-Not-Contain-Blanks/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Usernames-Should-Not-Have-A-Default/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/adminUsername-Should-Not-Be-A-Literal/Fail/Literal-Admin-Username.should.be.txt: -------------------------------------------------------------------------------- 1 | AdminUsername.Is.Literal 2 | -------------------------------------------------------------------------------- /unit-tests/CreateUIDefinition-Must-Not-Have-Blanks/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/CreateUIDefinition-Should-Have-Schema/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Deployment-Resources-Must-Not-Be-Debug/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Schema/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/HideExisting-Must-Be-Correctly-Handled/Fail/Missing-ResourceGroup.should.be.txt: -------------------------------------------------------------------------------- 1 | Missing.Output.ResourceGroup 2 | 3 | -------------------------------------------------------------------------------- /unit-tests/HideExisting-Must-Be-Correctly-Handled/Fail/explicit-false-missing-neworexisting.txt: -------------------------------------------------------------------------------- 1 | Missing.Output.NewOrExisting 2 | -------------------------------------------------------------------------------- /unit-tests/HideExisting-Must-Be-Correctly-Handled/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/IDs-Should-Be-Derived-From-ResourceIDs/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/URIs-Should-Be-Properly-Constructed/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Virtual-Machines-Should-Not-Be-Preview/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/adminUsername-Should-Not-Be-A-Literal/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/providers_apiVersions-Is-Not-Permitted/Fail/Uses-Providers-ApiVersion.should.be.txt: -------------------------------------------------------------------------------- 1 | ApiVersion.Using.Providers 2 | -------------------------------------------------------------------------------- /unit-tests/providers_apiVersions-Is-Not-Permitted/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Credential-Confirmation-Should-Not-Be-Hidden/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-ContentVersion/Fail/Missing.parameters.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameters.Missing.ContentVersion -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Parameters/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Fail/InvalidKeyVaultId.parameters.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameters.Parameter.Bad.KeyVault.Id -------------------------------------------------------------------------------- /unit-tests/ManagedIdentityExtension-must-not-be-used/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Secure-String-Parameters-Cannot-Have-Default/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Common/Pass/100-marketplace-sample/scripts/FileToBeCopied.txt: -------------------------------------------------------------------------------- 1 | This is the file in Azure storage that will be copied to the VM. -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-ContentVersion/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Fail/BadSecretNameKeyVault.parameters.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameters.Parameter.Bad.SecretName -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Fail/InvalidParameterObject.parameters.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameters.Parameter.Missing.Value -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Fail/MissingKeyVaultId.parameters.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameters.Parameter.Missing.KeyVault.Id -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Must-Not-Contain-Hardcoded-Uri/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Dynamic-Variable-References-Should-Not-Use-Concat/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Be-Present-In-Template-Parameters/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/CommandToExecute-Must-Use-ProtectedSettings-For-Secrets/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/Password-Textboxes-Must-Be-Used-For-Password-Parameters/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /arm-ttk/GitHubWorkflow/Jobs/RunTTK.psd1: -------------------------------------------------------------------------------- 1 | 2 | @{ 3 | "runs-on" = "ubuntu-latest" 4 | steps = @('Checkout','CheckoutTTK', 'RunTTK') 5 | } 6 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Fail/MissingSecretNameKeyVault.parameters.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameters.Parameter.Missing.SecretName -------------------------------------------------------------------------------- /unit-tests/Parameters-Without-Default-Must-Exist-In-CreateUIDefinition/Pass/MarketplaceSample.path.txt: -------------------------------------------------------------------------------- 1 | ..\..\Common\Pass\100-marketplace-sample 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Fail/InvalidParameterObjectReference.parameters.should.be.txt: -------------------------------------------------------------------------------- 1 | Parameters.Parameter.CannotBeReference -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/Fail/BadSchema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://thisisnotazure.com/schemas/deploymentTemplate" 3 | } 4 | -------------------------------------------------------------------------------- /arm-ttk/Test-AzTemplate.cmd: -------------------------------------------------------------------------------- 1 | powershell.exe -noprofile -nologo -command "Import-Module '%~dp0arm-ttk.psd1'; Test-AzTemplate %*; if ($Error.Count) { exit 1}" 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Schema/Fail/BadSchema.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://thisisnotazure.com/schemas/deploymentParameters" 3 | } 4 | -------------------------------------------------------------------------------- /arm-ttk/GitHubWorkflow/Jobs/TestPowerShellOnLinux.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | "runs-on" = "ubuntu-latest" 3 | steps = @('Checkout','InstallPester', 'RunPester', 'PublishTestResults') 4 | } -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Fail/OutputMismatch/README.md: -------------------------------------------------------------------------------- 1 | This directory contains a CreateUIDefinition that outputs a property not found in AzureDeploy. 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/Pass/2015-01-01.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#" 3 | } 4 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/Pass/2019-04-01.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#" 3 | } 4 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/Fail/NoSchema-But-Resources.json: -------------------------------------------------------------------------------- 1 | { 2 | resources: [ 3 | { 4 | name: "foo" 5 | } 6 | ] 7 | } 8 | 9 | -------------------------------------------------------------------------------- /unit-tests/_arm-ttk-module/Sample.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | // This is a JSONC file test 3 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#" 4 | } 5 | -------------------------------------------------------------------------------- /unit-tests/artifacts-parameter/artifacts-parameter.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Pass/ValueAllowed/README.md: -------------------------------------------------------------------------------- 1 | This directory contains an output in CreateUIDefinition.json/basics that matches to a parameter in AzureDeploy.json 2 | -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Pass/MultiSelectAllowed/README.md: -------------------------------------------------------------------------------- 1 | This directory contains an output in CreateUIDefinition.json/basics that matches to a parameter in AzureDeploy.json 2 | -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Pass/ValueAllowedInSteps/README.md: -------------------------------------------------------------------------------- 1 | This directory contains an output in CreateUIDefinition.json/basics that matches to a parameter in AzureDeploy.json 2 | -------------------------------------------------------------------------------- /unit-tests/DependsOn-Best-Practices/DependsOn-Best-Practices.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-ContentVersion/Fail/Missing.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | } 4 | -------------------------------------------------------------------------------- /unit-tests/Handler-Must-Be-Correct/Handler-Must-Be-Correct.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/JSONFiles-Should-Be-Valid/JSONFiles-Should-Be-Valid.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Textboxes-Are-Well-Formed/Textboxes-Are-Well-Formed.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /arm-ttk/GitHubWorkflow/Steps/RunTTK.ps1: -------------------------------------------------------------------------------- 1 | Import-Module ./ttk/arm-ttk/ -Force -PassThru | Out-Host 2 | Get-ChildItem -Recurse -Filter *.json | 3 | Where-Object Path -notlike '*ttk*' | 4 | Test-AzTemplate 5 | -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Fail/MultiSelectWithBadValue/README.md: -------------------------------------------------------------------------------- 1 | This directory contains an output in CreateUIDefinition.json/basics that matches to a parameter in AzureDeploy.json 2 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/Pass/2019-08-01-tenantDeploymentTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-08-01/tenantDeploymentTemplate.json#" 3 | } 4 | -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Tooltips-Should-Be-Present.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/VMSizes-Must-Match-Template/VMSizes-Must-Match-Template.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Pass/ValueAllowedInStepsSection/README.md: -------------------------------------------------------------------------------- 1 | This directory contains an output in CreateUIDefinition.json/basics that matches to a parameter in AzureDeploy.json 2 | -------------------------------------------------------------------------------- /unit-tests/Controls-In-Outputs-Must-Exist/Controls-In-Outputs-Must-Exist.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Location-Should-Be-In-Outputs/Location-Should-Be-In-Outputs.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Min-And-Max-Value-Are-Numbers/Min-And-Max-Value-Are-Numbers.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Parameters-Must-Be-Referenced/Parameters-Must-Be-Referenced.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Password-params-must-be-secure/Password-params-must-be-secure.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/ResourceIds-should-not-contain/ResourceIds-should-not-contain.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Resources-Should-Have-Location/Resources-Should-Have-Location.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/VM-Size-Should-Be-A-Parameter/VM-Size-Should-Be-A-Parameter.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Validations-Must-Have-Message/Validations-Must-Have-Message.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Variables-Must-Be-Referenced/Variables-Must-Be-Referenced.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/apiversions-should-be-recent/apiversions-should-be-recent.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /arm-ttk/GitHubWorkflow/Jobs/UpdateTTKCache.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | "runs-on" = "ubuntu-latest" 3 | steps = @( 4 | 'Checkout', 5 | 'AzureLogin', 6 | 'UpdateTTKCache' 7 | ) 8 | } 9 | 10 | -------------------------------------------------------------------------------- /unit-tests/Location-Should-Not-Be-Hardcoded/Location-Should-Not-Be-Hardcoded.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Not-Contain-Secrets/Outputs-Must-Not-Contain-Secrets.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/Pass/2018-05-01-subscriptionDeploymentTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#" 3 | } 4 | -------------------------------------------------------------------------------- /unit-tests/PasswordBoxes-Must-Have-Min-Length/PasswordBoxes-Must-Have-Min-Length.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Resources-Should-Not-Be-Ambiguous/Resources-Should-Not-Be-Ambiguous.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Secure-Params-In-Nested-Deployments/Secure-Params-In-Nested-Deployments.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Template-Should-Not-Contain-Blanks/Template-Should-Not-Contain-Blanks.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/URIs-Should-Be-Properly-Constructed/URIs-Should-Be-Properly-Constructed.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Usernames-Should-Not-Have-A-Default/Usernames-Should-Not-Have-A-Default.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /arm-ttk/arm-ttk.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | ModuleVersion = 0.26 3 | ModuleToProcess = 'arm-ttk.psm1' 4 | Description = 'Validation tools for Azure Resource Manager Templates' 5 | FormatsToProcess = 'arm-ttk.format.ps1xml' 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/CreateUIDefinition-Should-Have-Schema/CreateUIDefinition-Should-Have-Schema.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-ContentVersion/Fail/NotString.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | "contentVersion": 1 4 | } 5 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/DeploymentParameters-Should-Property.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/DeploymentTemplate-Schema-Is-Correct.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/Pass/2019-08-01-managementGroupDeploymentTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-08-01/managementGroupDeploymentTemplate.json#" 3 | } 4 | -------------------------------------------------------------------------------- /unit-tests/Parameter-Types-Should-Be-Consistent/Parameter-Types-Should-Be-Consistent.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/adminPassword-Should-Not-Be-A-Literal/adminPassword-Should-Not-Be-A-Literal.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/adminUsername-Should-Not-Be-A-Literal/adminUsername-Should-Not-Be-A-Literal.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Pass/SkuAllowed/AzureDeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "parameters": { 3 | "skuCode": { 4 | "type": "string", 5 | "defaultValue": "B3" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /unit-tests/CreateUIDefinition-Must-Not-Have-Blanks/CreateUIDefinition-Must-Not-Have-Blanks.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Deployment-Resources-Must-Not-Be-Debug/Deployment-Resources-Must-Not-Be-Debug.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Parameters/Fail/NotExist.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Schema/DeploymentParameters-Should-Have-Schema.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/HideExisting-Must-Be-Correctly-Handled/HideExisting-Must-Be-Correctly-Handled.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/IDs-Should-Be-Derived-From-ResourceIDs/IDs-Should-Be-Derived-From-ResourceIDs.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Parameters-Must-Be-Referenced/Pass/emptyparameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [] 5 | } -------------------------------------------------------------------------------- /unit-tests/Password-params-must-be-secure/Pass/emptyparameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [] 5 | } -------------------------------------------------------------------------------- /unit-tests/Virtual-Machines-Should-Not-Be-Preview/Virtual-Machines-Should-Not-Be-Preview.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/cache/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Running Tests 3 | 4 | When running unit tests, use the cache files here, so that a new update doesn't break the tests. 5 | 6 | Also set the test date to on or close to the date of the cache files 7 | -------------------------------------------------------------------------------- /unit-tests/providers_apiVersions-Is-Not-Permitted/providers_apiVersions-Is-Not-Permitted.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Allowed-Values-Should-Actually-Be-Allowed.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Location-Should-Not-Be-Hardcoded/Pass/emptyparameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [] 5 | } -------------------------------------------------------------------------------- /unit-tests/ManagedIdentityExtension-must-not-be-used/ManagedIdentityExtension-must-not-be-used.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Credential-Confirmation-Should-Not-Be-Hidden/Credential-Confirmation-Should-Not-Be-Hidden.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Parameters/DeploymentParameters-Should-Have-Parameters.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Handler-Must-Be-Correct/Fail/InvalidHandler/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/Handler-Must-Be-Correct/Fail/MissingHandler/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/Secure-String-Parameters-Cannot-Have-Default/Secure-String-Parameters-Cannot-Have-Default.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-ContentVersion/DeploymentParameters-Should-Have-ContentVersion.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Be-Present-In-Template-Parameters/Outputs-Must-Be-Present-In-Template-Parameters.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Fail/MissingTooltip/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /arm-ttk/ttk.SampleWorkflow.PSDevOps.ps1: -------------------------------------------------------------------------------- 1 | #requires -Module PSDevOps 2 | Import-BuildStep -ModuleName arm-ttk 3 | Push-Location $PSScriptRoot 4 | New-GitHubWorkflow -On Push -Job RunTTK | Set-Content .\SampleWorkflow.yml -Encoding UTF8 5 | Pop-Location 6 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Must-Not-Contain-Hardcoded-Uri/DeploymentTemplate-Must-Not-Contain-Hardcoded-Uri.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Dynamic-Variable-References-Should-Not-Use-Concat/Dynamic-Variable-References-Should-Not-Use-Concat.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Pass/apiControlRequestBody/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Schema/Pass/2015-01-01.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {} 5 | } 6 | -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Pass/InfoboxTooltipNotRequired/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Pass/TextBlockTooltipNotRequired/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/Usernames-Should-Not-Have-A-Default/Fail/DefaultUsername/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/apiVersions-Should-Be-Recent-In-Reference-Functions.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /arm-ttk/AzRMTester.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | ModuleVersion = 0.3 3 | ModuleToProcess = 'arm-ttk.psm1' 4 | Description = 'Validation tools for Azure Resource Manager Templates' 5 | FormatsToProcess = 'arm-ttk.format.ps1xml' 6 | } 7 | # Added for backward compat for MP -------------------------------------------------------------------------------- /unit-tests/CommandToExecute-Must-Use-ProtectedSettings-For-Secrets/CommandToExecute-Must-Use-ProtectedSettings-For-Secrets.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Credential-Confirmation-Should-Not-Be-Hidden/Fail/PasswordBox/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Fail/InvalidParameterObject.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | "parameters":{ 4 | "someKey": {} 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Must-Not-Contain-Hardcoded-Uri/Fail/Hardcoded-Uri.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema":"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "variables":{ 4 | "AzureURL":"management.azure.com" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/Password-Textboxes-Must-Be-Used-For-Password-Parameters/Password-Textboxes-Must-Be-Used-For-Password-Parameters.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Pass/EditableGridTooltipNotRequired/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/Credential-Confirmation-Should-Not-Be-Hidden/Fail/CredentialsCombo/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/Parameters-Must-Be-Referenced/Pass/SkipMe.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "__skipme": { 5 | "type": "bool" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /unit-tests/Password-params-must-be-secure/Pass/SkipMe.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "__skipme": { 5 | "type": "bool" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /unit-tests/Min-And-Max-Value-Are-Numbers/Fail/Missing-Max.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "foo": { 5 | "minValue": 10 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /unit-tests/Min-And-Max-Value-Are-Numbers/Fail/Missing-Min.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "foo": { 5 | "maxValue": 100 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /unit-tests/Parameters-Without-Default-Must-Exist-In-CreateUIDefinition/Parameters-Without-Default-Must-Exist-In-CreateUIDefinition.tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | #requires -module arm-ttk 3 | . $PSScriptRoot\..\arm-ttk.test.functions.ps1 4 | Test-TTK $psScriptRoot 5 | return 6 | 7 | -------------------------------------------------------------------------------- /unit-tests/Common/Pass/empty/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "variables": {}, 6 | "resources": [], 7 | "outputs": {} 8 | } 9 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Must-Not-Contain-Hardcoded-Uri/Fail/Hardcoded-Full-Uri.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema":"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "variables":{ 4 | "AzureURL":"https://management.azure.com" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/Variables-Must-Be-Referenced/Fail/Unreferenced-Variable.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "variables": { 4 | "foo": { 5 | "default": 1 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Must-Not-Contain-Hardcoded-Uri/Fail/Hardcoded-Uri-In-Uri.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema":"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "variables":{ 4 | "AzureSchemaURL":"[uri('gallery.azure.com','foo')]" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/Parameters-Must-Be-Referenced/Fail/NotUsed.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema":"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters":{ 5 | "notUsedAnywhere":{"type":"string"} 6 | }, 7 | "resources":[] 8 | } 9 | -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Must-Not-Contain-Hardcoded-Uri/Fail/Hardcoded-Uri-In-Concat.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema":"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "variables":{ 4 | "AzureSchemaURL":"[concat('https://','gallery.azure.com')]" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /unit-tests/Template-Should-Not-Contain-Blanks/Fail/null-var.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "nullVar": null 6 | }, 7 | "resources":[] 8 | } 9 | -------------------------------------------------------------------------------- /arm-ttk/GitHubWorkflow/Steps/CheckoutTTK.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | name = 'Checkout TTK' 3 | uses = 'actions/checkout@v2' 4 | id = 'CheckoutTTK' 5 | with = @{ 6 | # Exclude = '*.tests.ps1;*.psdevops.ps1' 7 | repository = 'Azure/arm-ttk' 8 | path = 'ttk' 9 | } 10 | } -------------------------------------------------------------------------------- /unit-tests/Common/Pass/100-marketplace-sample/README.md: -------------------------------------------------------------------------------- 1 | This was copied from [the Azure Quickstart Repository - 100-marketplace-sample](https://github.com/Azure/azure-quickstart-templates/tree/master/100-marketplace-sample), 2 | 3 | as an example of how to include sample test templates in this repository. 4 | 5 | -------------------------------------------------------------------------------- /unit-tests/Dynamic-Variable-References-Should-Not-Use-Concat/Fail/Dynamic-Concat-Parameter.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "variables": { 4 | "var": "[variables(concat('imageOS'), parameters('osType'))]" 5 | } 6 | } 7 | 8 | 9 | -------------------------------------------------------------------------------- /unit-tests/Min-And-Max-Value-Are-Numbers/Fail/Min-Is-Not-Int.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "foo": { 5 | "minValue": "OneHundred", 6 | "maxValue": 1000 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /unit-tests/Template-Should-Not-Contain-Blanks/Fail/empty-array.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "emptyArray": [ 6 | ] 7 | }, 8 | "resources":[] 9 | } 10 | -------------------------------------------------------------------------------- /unit-tests/URIs-Should-Be-Properly-Constructed/Fail/URI-Using-Concat.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "aUri": "[concat('foo', 'bar')]" 6 | } 7 | ] 8 | } 9 | 10 | -------------------------------------------------------------------------------- /unit-tests/Variables-Must-Be-Referenced/Fail/dollar.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "$": "#bin/bash\necho 'hi'" 6 | }, 7 | "resources": [ 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /unit-tests/DependsOn-Best-Practices/Fail/DependsOn-Has-If.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "dependsOn": [ 6 | "[if(false)]" 7 | ] 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /unit-tests/IDs-Should-Be-Derived-From-ResourceIDs/Fail/bool.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "fail1": { 6 | "Someid": true 7 | } 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /unit-tests/Min-And-Max-Value-Are-Numbers/Fail/Max-Is-Not-Int.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "foo": { 5 | "minValue": 10, 6 | "maxValue": "OneHundred" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /unit-tests/Min-And-Max-Value-Are-Numbers/Pass/Min-And-Max-Are-Present.json: -------------------------------------------------------------------------------- 1 | { 2 | "parameters": { 3 | "foo": { 4 | "minvalue": 10, 5 | "maxValue": 100 6 | } 7 | }, 8 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#" 9 | } 10 | -------------------------------------------------------------------------------- /unit-tests/Template-Should-Not-Contain-Blanks/Fail/empty-object.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "emptyObject": { 6 | } 7 | }, 8 | "resources":[] 9 | } 10 | -------------------------------------------------------------------------------- /unit-tests/URIs-Should-Be-Properly-Constructed/Fail/URI-Using-Format.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "aUri": "[format('foo {0}', 'bar')]" 6 | } 7 | ] 8 | } 9 | 10 | -------------------------------------------------------------------------------- /unit-tests/IDs-Should-Be-Derived-From-ResourceIDs/Fail/int.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | 6 | "fail2": { 7 | "id": 1 8 | } 9 | 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /unit-tests/DependsOn-Best-Practices/Fail/DependsOn-Starts-With-Concat.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "dependsOn": [ 6 | "[concat('1')]" 7 | ] 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /unit-tests/IDs-Should-Be-Derived-From-ResourceIDs/Fail/literal.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "fail3": { 6 | "id": "/subscriptions/literal" 7 | } 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /unit-tests/Template-Should-Not-Contain-Blanks/Pass/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [], 8 | "outputs": {} 9 | } 10 | -------------------------------------------------------------------------------- /unit-tests/Controls-In-Outputs-Must-Exist/Fail/Missing-Step/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | }, 6 | "variables": { 7 | }, 8 | "resources": [ 9 | ], 10 | "outputs": { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /unit-tests/Common/Pass/empty/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [], 7 | "outputs": {} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /unit-tests/Password-params-must-be-secure/Pass/param-name-whitespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "pass words": { 6 | "type": "string" 7 | } 8 | }, 9 | "resources": [] 10 | } -------------------------------------------------------------------------------- /unit-tests/DependsOn-Best-Practices/Pass/DependsOn-Has-CopyIndex.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "dependsOn": [ 6 | "[concat(parameters('VMName'), CopyIndex(1))]" 7 | ] 8 | } 9 | ] 10 | } -------------------------------------------------------------------------------- /unit-tests/IDs-Should-Be-Derived-From-ResourceIDs/Fail/whitespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "someWhiteSpace": { 6 | "id": " [ concat( variables('id'))]" 7 | } 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /unit-tests/Secure-String-Parameters-Cannot-Have-Default/Pass/Blank-As-Default.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "SecureStringParameter": { 5 | "defaultValue": "", 6 | "type": "SecureString" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /unit-tests/CreateUIDefinition-Must-Not-Have-Blanks/Fail/CreateUIDefinition-With-Blanks/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | }, 6 | "variables": { 7 | }, 8 | "resources": [ 9 | ], 10 | "outputs": { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /unit-tests/Parameters-Must-Be-Referenced/Pass/Used-Directly-In-Variables.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "used2": { 5 | "type": "string" 6 | } 7 | }, 8 | "variables": { 9 | "foo": "[ parameters ( 'used2') ]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/Parameters-Must-Be-Referenced/Pass/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "my_Parameter": { 5 | "type": "string" 6 | } 7 | }, 8 | "variables": { 9 | "foo": "[ parameters ( 'My_Parameter') ]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/Secure-String-Parameters-Cannot-Have-Default/Pass/NewGuid-As-Default.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "SecureStringParameter": { 5 | "defaultValue": "[newGuid()]", 6 | "type": "SecureString" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /unit-tests/CreateUIDefinition-Must-Not-Have-Blanks/Fail/CreateUIDefinition-With-EmptyArray/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | }, 6 | "variables": { 7 | }, 8 | "resources": [ 9 | ], 10 | "outputs": { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /unit-tests/CreateUIDefinition-Must-Not-Have-Blanks/Fail/CreateUIDefinition-With-EmptyArray/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "NotBasics": [] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /unit-tests/CreateUIDefinition-Must-Not-Have-Blanks/Fail/CreateUIDefinition-With-EmptyObject/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | }, 6 | "variables": { 7 | }, 8 | "resources": [ 9 | ], 10 | "outputs": { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /unit-tests/CreateUIDefinition-Must-Not-Have-Blanks/Pass/CreateUIDefinition-With-Blank-Basics/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | }, 6 | "variables": { 7 | }, 8 | "resources": [ 9 | ], 10 | "outputs": { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /unit-tests/CreateUIDefinition-Must-Not-Have-Blanks/Pass/CreateUIDefinition-With-Blank-Basics/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /unit-tests/Parameters-Must-Be-Referenced/Pass/param-name-whitespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "two words": { 5 | "type": "string" 6 | } 7 | }, 8 | "variables": { 9 | "foo": "[ parameters ( 'two words') ]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/Parameters-Without-Default-Must-Exist-In-CreateUIDefinition/Pass/emptyString/mainTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "emptyPassword": { 6 | "type": "secureString" 7 | } 8 | }, 9 | "resources": [ ] 10 | } 11 | -------------------------------------------------------------------------------- /unit-tests/Secure-String-Parameters-Cannot-Have-Default/Fail/Hardcoded-Value.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "SecureStringParameter": { 5 | "defaultValue": "HardcodedPassword", 6 | "type": "SecureString" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /arm-ttk/Regex/ARM/BracketOrQuote.regex.txt: -------------------------------------------------------------------------------- 1 | # This matches a bracket or double quote. 2 | # We need this occassionally to determine if a value is within a string or an expression. 3 | # This is normally used with the option -RightToLeft, to seek backwards from a point to the matching [ or ". 4 | (?\d{4,4}) # A four digit year 3 | - # followed by a dash 4 | (?\d{2,2}) # Followed by a two digit month 5 | - # Followed by a dash 6 | (?\d{2,2}) # Followed by a two digit day 7 | (?: # Optionally followed by 8 | - # a dash 9 | (?\w+) # and a preview version word 10 | )? -------------------------------------------------------------------------------- /unit-tests/Location-Should-Not-Be-Hardcoded/Pass/global/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "global" 8 | } 9 | }, 10 | "functions": [], 11 | "variables": {}, 12 | "resources": [], 13 | "outputs": {} 14 | } -------------------------------------------------------------------------------- /unit-tests/ResourceIds-should-not-contain/Fail/format.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ], 6 | "outputs": { 7 | "fail": { 8 | "type": "string", 9 | "value": "[ reference( format('/providers/Microsoft.Authorization/type/name'), '2020-01-01', 'Full').someproperty]" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /unit-tests/ResourceIds-should-not-contain/Fail/list-nested.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ], 6 | "outputs": { 7 | "fail": { 8 | "type": "string", 9 | "value": "[concat(listAdminKeys (concat('Microsoft.Network/networkSecurityGroups', 'nsg'), '2020-01-01') )]" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /unit-tests/ResourceIds-should-not-contain/Fail/multi-line.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | 5 | 6 | "variables": { 7 | "fail6": "[subscriptionResourceId( 8 | subscription().id, 'Microsoft.Network/networkSecurityGroups', 'nsg')]" 9 | 10 | }, 11 | "resources": [ 12 | ], 13 | "outputs": { 14 | } 15 | } -------------------------------------------------------------------------------- /unit-tests/ResourceIds-should-not-contain/Fail/subscription-function.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | 5 | "variables": { 6 | "fail2": "[ resourceId ( subscription().subscriptionId, resourceGroup().name,'Microsoft.Network/virtualNetworks', 'vnet')]" 7 | }, 8 | "resources": [ 9 | 10 | ], 11 | "outputs": { 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /unit-tests/ResourceIds-should-not-contain/Fail/subscriptionResourceId.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | }, 6 | "variables": { 7 | "fail7": "[subscriptionResourceId(concat('Microsoft.Network/networkSecurityGroups'), 'nsg')]" 8 | }, 9 | "resources": [ 10 | ], 11 | "outputs": { 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /unit-tests/Variables-Must-Be-Referenced/Pass/bicep-generated-var.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "$fxv#0": "#bin/bash\necho 'hi'" 6 | }, 7 | "resources": [ 8 | ], 9 | "outputs": { 10 | "test": { 11 | "type": "string", 12 | "value": "[variables('$fxv#0')]" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Not-Contain-Secrets/Pass/Outputs-Can-Contain-Custom-List-Function.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "outputs": { 5 | "NotContainsListUDF": { 6 | "type": "string", 7 | "value": "[mylistUDF()]" //TODO since this doesn't have leading separator, it should not be flagged 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /unit-tests/ResourceIds-should-not-contain/Fail/reference-concat.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ], 6 | "outputs": { 7 | "fail": { 8 | "type": "string", 9 | "value": "[ reference( concat('/providers/Microsoft.Authorization/type/name'), '2020-01-01', 'Full').someproperty]" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Fail/old-apiVersion.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [], 8 | "outputs": { 9 | "oldIPReference": "[reference(resourceId('Microsoft.Network/publicIPAddresses', 'test'), '2015-06-15')]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/Parameters-Without-Default-Must-Exist-In-CreateUIDefinition/Pass/emptyString/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ ], 7 | "steps": [], 8 | "outputs": { 9 | "emptyPassword": "" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Fail/old-apiVersion-in-List.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [], 8 | "outputs": { 9 | "oldIPReference": "[list (resourceId('Microsoft.Network/publicIPAddresses', 'test'), '2015-06-15')]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/Handler-Must-Be-Correct/Fail/InvalidHandler/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.Bogus", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | } 9 | ], 10 | "outputs": { 11 | "Location": "[location()]" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Not-Contain-Secrets/Fail/Outputs-Cannot-Echo-ListKeys-With-Concat.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "outputs": { 5 | "containsListKeysConcat": { 6 | "type": "string", 7 | "value": "[concat('connection string blah=', listKeys ( 'storageAccountName','2017-10-01').keys[0].value)]" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /unit-tests/Parameters-Without-Default-Must-Exist-In-CreateUIDefinition/Pass/nestedParameter/CreateUIDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | {} 8 | ], 9 | "outputs": { 10 | "mainParameter": "value-from-ui" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Pass/NoApiVersion.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [], 8 | "outputs": { 9 | "NonPreviewVersionWhereSamePreviewDateExists" : "[reference(resourceId('Microsoft.DBforMySQL/servers', 'test'))]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/Fail/BadSchema.should.be.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [PSObject[]] 3 | $Results 4 | ) 5 | 6 | 7 | $unexpectedErrors = $Results | 8 | ForEach-Object { $_.Errors } | 9 | Select-Object -ExpandProperty Exception | 10 | Where-Object { 11 | $_.Message -notlike '*DeploymentTemplate has an unexpected Schema.*' 12 | } | 13 | Select-Object -ExpandProperty Message 14 | 15 | if ($unexpectedErrors) { 16 | throw $unexpectedErrors 17 | } -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Not-Contain-Secrets/Fail/Outputs-Cannot-Contain-Strings-Named-Password.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "outputs": { 5 | "nameContainsPassword": { 6 | "type": "string", 7 | "value": "a secret may be contained in a variable or a non-secure string, but the output name will give an indication" 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Fail/old-apiVersion-in-ListKeys.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [], 8 | "outputs": { 9 | "oldIPReference": "[listKeys(resourceId('Microsoft.Network/publicIPAddresses', 'test'), '2015-06-15')]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Pass/latestStableApiOlderThan2Years.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [], 8 | "outputs": { 9 | "oldIPReference": "[reference(resourceId('Microsoft.Web/connections', 'test'), '2016-06-01', 'Full')]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/Location-Should-Not-Be-Hardcoded/Pass/deployment.location/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[deployment().location]" 8 | } 9 | }, 10 | "functions": [], 11 | "variables": {}, 12 | "resources": [], 13 | "outputs": {} 14 | } -------------------------------------------------------------------------------- /unit-tests/artifacts-parameter/Pass/nested-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "_artifactsLocation": { 6 | "type": "string" 7 | }, 8 | "_artifactsLocationSasToken": { 9 | "type": "securestring" 10 | } 11 | }, 12 | "resources": [ 13 | ], 14 | "outputs": { 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /unit-tests/Deployment-Resources-Must-Not-Be-Debug/Pass/DebugSettingsOmit.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "type": "Microsoft.Resources/deployments", 7 | "apiVersion": "2019-05-01", 8 | "name": "unitTest", 9 | "properties": { 10 | 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /unit-tests/VM-Size-Should-Be-A-Parameter/Fail/Fixed-VM-Size.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "type": "Microsoft.Compute/virtualMachines", 6 | "name": "failed-vm", 7 | "properties": { 8 | "hardwareProfile": { 9 | "vmSize": "Standard_D2_v3" 10 | } 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Fail/old-apiVersion-FullReference.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [], 8 | "outputs": { 9 | "oldIPReference": "[reference(resourceId('Microsoft.Network/publicIPAddresses', 'test'), '2015-06-15', 'Full')]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Fail/old-apiVersion-NestedResource.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [], 8 | "outputs": { 9 | "oldIPReference": "[reference(resourceId('Microsoft.Network/virtualNetworks/subnets', 'test'), '2015-06-15')]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Fail/old-apiVersion-in-ListAccountSas.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [], 8 | "outputs": { 9 | "oldIPReference": "[listAccountSas(resourceId('Microsoft.Network/publicIPAddresses', 'test'), '2015-06-15')]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/artifacts-parameter/Fail/missing-sas/mainTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "_artifactsLocation": { 6 | "type": "string", 7 | "defaultValue": "[deployment().properties.templateLink.uri]" 8 | } // missing the sasToken 9 | }, 10 | "resources": [ 11 | ], 12 | "outputs": { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /unit-tests/Location-Should-Not-Be-Hardcoded/Fail/mainTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "westus" //specific location not allowed as a default 8 | } 9 | }, 10 | "functions": [], 11 | "variables": {}, 12 | "resources": [], 13 | "outputs": {} 14 | } -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Not-Contain-Secrets/Fail/Outputs-Cannot-Echo-ListKeys-In-Secret-Object.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "outputs": { 5 | "containsListInSecretObject": { 6 | "type": "object", 7 | "value": { 8 | "key": "[trim(listKeys('storageAccountName','2017-10-01').keys[0].value)]" 9 | } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /unit-tests/Location-Should-Not-Be-Hardcoded/Fail/nested-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "global" //defaultValues not allowed in nested templates 8 | } 9 | }, 10 | "functions": [], 11 | "variables": {}, 12 | "resources": [], 13 | "outputs": {} 14 | } -------------------------------------------------------------------------------- /unit-tests/artifacts-parameter/Fail/nested-wrong-type.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "_artifactsLocation": { 6 | "type": "array" //wrong type 7 | }, 8 | "_artifactsLocationSasToken": { 9 | "type": "string" //wrong type 10 | } 11 | }, 12 | "resources": [ 13 | ], 14 | "outputs": { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /unit-tests/artifacts-parameter/Fail/wrong-type/mainTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "_artifactsLocation": { 6 | "type": "array" //wrong type 7 | }, 8 | "_artifactsLocationSasToken": { 9 | "type": "string" //wrong type 10 | } 11 | }, 12 | "resources": [ 13 | ], 14 | "outputs": { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /unit-tests/ResourceIds-should-not-contain/Fail/reference-nested.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ], 6 | "outputs": { 7 | "fail": { 8 | "type": "string", 9 | "value": "[replace(replace(concat(reference(concat('Microsoft.Storage/storageAccounts/', 'sa-name'), '2017-10-01').primaryEndpoints.blob),'https:',''),'/','')]" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /unit-tests/Resources-Should-Not-Be-Ambiguous/Pass/ResourceTypeFirstParameter (fail test).json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | 5 | // this is a failure test case, but the test is being removed due to #478 6 | 7 | "variables": { 8 | "trailingslash": "[resourceId('Microsoft.Network/networkSecurityGroups', 'nsg')]" 9 | 10 | }, 11 | "resources": [ 12 | ], 13 | "outputs": { 14 | } 15 | } -------------------------------------------------------------------------------- /unit-tests/Virtual-Machines-Should-Not-Be-Preview/Fail/Latest-Preview2.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "type": "Microsoft.Compute/virtualMachines", 6 | "apiVersion": "2019-12-01", 7 | "properties": { 8 | "storageProfile": { 9 | "imageReference": "latest-preview" 10 | } 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /unit-tests/Resources-Should-Not-Be-Ambiguous/Pass/TrailingSlash (fail test).json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | 5 | // this is a failure test case, but the test is being removed due to #478 6 | 7 | "variables": { 8 | "trailingslash": "[resourceId('otherRg', 'Microsoft.Network/networkSecurityGroups/', 'nsg')]" 9 | 10 | }, 11 | "resources": [ 12 | ], 13 | "outputs": { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Pass/NonPreviewVersionWhereSamePreviewDateExists.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [], 8 | "outputs": { 9 | "NonPreviewVersionWhereSamePreviewDateExists" : "[reference(resourceId('Microsoft.DBforMySQL/servers', 'test'), '2017-12-01')]" 10 | } 11 | } -------------------------------------------------------------------------------- /unit-tests/Resources-Should-Not-Be-Ambiguous/Pass/topLevelChild.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "resourceReference": "[resourceId('otherResourceGroup', 'Microsoft.Network/virtualMachines/extensions', 'vm', 'ext')]" 6 | }, 7 | "resources": [ 8 | { 9 | "type": "Microsoft.Compute/virtualMachines/extensions", 10 | "name": "vm/ext" 11 | } 12 | ], 13 | "outputs": {} 14 | } 15 | -------------------------------------------------------------------------------- /unit-tests/Variables-Must-Be-Referenced/Pass/Variable-List-Value.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "foo": { 5 | "type": "string", 6 | "defaultValue": "[variables('foo')]" 7 | } 8 | }, 9 | "variables": { 10 | "foo": [ 11 | { 12 | "bar": 1 13 | }, 14 | { 15 | "bar": 2 16 | } 17 | ] 18 | } 19 | } -------------------------------------------------------------------------------- /unit-tests/artifacts-parameter/Fail/missing-defaults/mainTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "_artifactsLocation": { //both are missing defaultValues 6 | "type": "string" 7 | }, 8 | "_artifactsLocationSasToken": { 9 | "type": "securestring" 10 | } 11 | }, 12 | "resources": [ 13 | ], 14 | "outputs": { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /arm-ttk/Update-TTKCache.ps1: -------------------------------------------------------------------------------- 1 | function Update-TTKCache { 2 | <# 3 | .Synopsis 4 | Updates the TTK Cache 5 | .Description 6 | Updates the /cache/ information in the Azure Resource Manager Template Toolkit 7 | .Example 8 | Update-TTKCache 9 | #> 10 | param() 11 | 12 | $MyInvocation.MyCommand.ScriptBlock.File | 13 | Split-Path | 14 | Join-Path -ChildPath cache | 15 | Get-ChildItem -Filter *.init.cache.ps1 | 16 | ForEach-Object { 17 | & $_.Fullname 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /arm-ttk/cache/AllEnvironments.init.cache.ps1: -------------------------------------------------------------------------------- 1 | $MyFile= $MyInvocation.MyCommand.ScriptBlock.File 2 | $myName = $MyFile | Split-Path -Leaf 3 | $myName = $myName -replace '\.init\.cache\.ps1' 4 | $myRoot = $MyFile | Split-Path 5 | $MyOutputFile = Join-Path $myRoot "$myName.cache.json" 6 | 7 | 8 | $azEnv = Get-AzEnvironment 9 | if (-not $azEnv) { 10 | Write-Error "Could not list providers. You may not be logged in." 11 | return 12 | } 13 | 14 | $azEnv | Sort-Object Name | ConvertTo-Json -Depth 100 | Set-Content $MyOutputFile 15 | -------------------------------------------------------------------------------- /unit-tests/Deployment-Resources-Must-Not-Be-Debug/Pass/DebugSettingsNone.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "type": "Microsoft.Resources/deployments", 7 | "apiVersion": "2019-05-01", 8 | "name": "unitTest", 9 | "properties": { 10 | "debugSetting": { "detailLevel": "None" } 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /unit-tests/Resources-Should-Have-Location/Pass/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [ 8 | { 9 | "type": "Microsoft.Network/privateDnsZones", 10 | "apiVersion": "2020-06-01", 11 | "name": "name", 12 | "location": "global" 13 | } 14 | ], 15 | "outputs": {} 16 | } -------------------------------------------------------------------------------- /unit-tests/Variables-Must-Be-Referenced/Fail/Unreferenced-Variable-Copy-Property.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "variables": { 4 | "variableToCopy": { 5 | "copy": [ 6 | { 7 | "name": "foo", 8 | "count": "[parameters('itemCount')]", 9 | "input": "[concat('item', copyIndex('stringArray', 1))]" 10 | } 11 | ] 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Fail/MissingSecretNameKeyVault.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | "parameters":{ 4 | "someKeyVaultKey": { 5 | "reference": { 6 | "keyVault": { 7 | "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.KeyVault/vaults/myvault" 8 | }, 9 | "secretKey": "value1" 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /unit-tests/Deployment-Resources-Must-Not-Be-Debug/Fail/DebugSettingRequest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "type": "Microsoft.Resources/deployments", 7 | "apiVersion": "2019-05-01", 8 | "name": "unitTest", 9 | "properties": { 10 | "debugSetting": { "detailLevel": "RequestContent" } 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /unit-tests/Deployment-Resources-Must-Not-Be-Debug/Fail/DebugSettingResponse.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "type": "Microsoft.Resources/deployments", 7 | "apiVersion": "2019-05-01", 8 | "name": "unitTest", 9 | "properties": { 10 | "debugSetting": { "detailLevel": "ResponseContent" } 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /unit-tests/HideExisting-Must-Be-Correctly-Handled/Fail/Missing-Output.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Compute.MultiVm", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [], 7 | "steps": [ 8 | { 9 | "name": "dbAdminPassword", 10 | "type": "Microsoft.Storage.StorageAccountSelector" 11 | } 12 | ], 13 | "outputs": { 14 | "foo": "bar" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /arm-ttk/GitHubWorkflow/Steps/InstallPester.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Installs Pester 4 | .Description 5 | Installs Pester 6 | #> 7 | param( 8 | # The maximum pester version. Defaults to 4.99.99. 9 | [string] 10 | $PesterMaxVersion = '4.99.99' 11 | ) 12 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 13 | Install-Module -Name Pester -Repository PSGallery -Force -Scope CurrentUser -MaximumVersion $PesterMaxVersion -SkipPublisherCheck -AllowClobber 14 | Import-Module Pester -Force -PassThru -MaximumVersion $PesterMaxVersion -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Fail/BadSecretNameKeyVault.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | "parameters":{ 4 | "someKeyVaultKey": { 5 | "reference": { 6 | "keyVault": { 7 | "id" :"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.KeyVault/vaults/myvault" 8 | }, 9 | "secretName": "underscore_not_allowed" 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /unit-tests/Location-Should-Not-Be-Hardcoded/Pass/no-parameters/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "type": "Microsoft.Network/privateDnsZones", 7 | "apiVersion": "2018-09-01", 8 | "name": "scratch", 9 | "location": "global", 10 | "properties": { 11 | "maxNumberOfRecordSets": 25000 12 | } 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Not-Contain-Secrets/Fail/Outputs-Cannot-Contain-SecureString-Parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "SecureStringParam2": { 6 | "type": "secureString" 7 | } 8 | }, 9 | "outputs": { 10 | "ContainsParamSecureString": { 11 | "type": "string", 12 | "value": "[ parameters ('SecureStringParam2') ]" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /unit-tests/Resources-Should-Have-Location/Fail/hardcoded.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "name": "publicIPAddress1", 7 | "type": "Microsoft.Network/publicIPAddresses", 8 | "apiVersion": "2019-11-01", 9 | "location": "westeurope", 10 | "properties": { 11 | "publicIPAllocationMethod": "Dynamic" 12 | } 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /unit-tests/Deployment-Resources-Must-Not-Be-Debug/Fail/DebugSettingRequestResponse.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "type": "Microsoft.Resources/deployments", 7 | "apiVersion": "2019-05-01", 8 | "name": "unitTest", 9 | "properties": { 10 | "debugSetting": { "detailLevel": "RequestContent, ResponseContent" } 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Not-Contain-Secrets/Fail/Outputs-Cannot-Contain-SecureString-Parameters-Trimmed.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "SecureStringParam": { 6 | "type": "secureString" 7 | } 8 | }, 9 | "outputs": { 10 | "ContainsParamSecureStringTrim": { 11 | "type": "string", 12 | "value": "[ trim ( parameters ( 'SecureStringParam' ) )]" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /unit-tests/apiversions-should-be-recent/Pass/PreviewOnlyApi.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "apiVersion": "2018-09-15", // is the latest non-preview version - "2018-10-15-preview" is the latest preview version 7 | "name": "namespace", 8 | "type": "Microsoft.DevTestLab/schedules", 9 | "location": "global", 10 | "properties": { 11 | } 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /arm-ttk/GitHubWorkflow/Steps/UpdateTTKCache.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | name = "Update TTK Cache" 3 | uses = "Azure/powershell@v1" 4 | with = @{ 5 | "inlineScript" = @' 6 | Get-ChildItem -Recurse -Filter arm-ttk.psd1 | Import-Module -Name { $_.FullName} -Force -PassThru | Out-String 7 | Update-TTKCache 8 | '@ 9 | "azPSVersion" = "3.1.0" 10 | } 11 | } 12 | <# 13 | name: Azure PowerShell Action 14 | uses: Azure/powershell@v1 15 | with: 16 | inlineScript: Get-AzVM -ResourceGroupName "< YOUR RESOURCE GROUP >" 17 | azPSVersion: 3.1.0 18 | #> 19 | -------------------------------------------------------------------------------- /unit-tests/Controls-In-Outputs-Must-Exist/Fail/Missing-ElementName/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "steps": [ 7 | { 8 | "name": "vmProperties", 9 | "elements": [] 10 | } 11 | ], 12 | "outputs": { 13 | "vmName": "[steps('vmProperties').vmName]" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /unit-tests/HideExisting-Must-Be-Correctly-Handled/Fail/Missing-NewOrExisting.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Compute.MultiVm", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [], 7 | "steps": [ 8 | { 9 | "name": "dbAdminPassword", 10 | "type": "Microsoft.Storage.StorageAccountSelector" 11 | } 12 | ], 13 | "outputs": { 14 | "resourceGroup": "steps('dbAdminPassword').resourceGroup" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /unit-tests/HideExisting-Must-Be-Correctly-Handled/Fail/Missing-ResourceGroup.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Compute.MultiVm", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [], 7 | "steps": [ 8 | { 9 | "name": "dbAdminPassword", 10 | "type": "Microsoft.Storage.StorageAccountSelector" 11 | } 12 | ], 13 | "outputs": { 14 | "newOrExisting": "steps('dbAdminPassword').newOrExisting" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /unit-tests/Parameters-Without-Default-Must-Exist-In-CreateUIDefinition/Fail/MissingCreateUIParameter/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | 9 | } 10 | ], 11 | "outputs": { 12 | "Location": "[location()]", 13 | "MyPassword": "[basics('PasswordBox')]" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /unit-tests/artifacts-parameter/Fail/nested-with-defaults.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "_artifactsLocation": { 6 | "type": "string", 7 | "defaultValue": "[deployment().properties.templateLink.uri]" 8 | }, 9 | "_artifactsLocationSasToken": { 10 | "type": "securestring", 11 | "defaultValue": "" 12 | } 13 | }, 14 | "resources": [ 15 | ], 16 | "outputs": { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /unit-tests/artifacts-parameter/Pass/deployment-function/mainTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "_artifactsLocation": { 6 | "type": "string", 7 | "defaultValue": "[deployment().properties.templateLink.uri]" 8 | }, 9 | "_artifactsLocationSasToken": { 10 | "type": "securestring", 11 | "defaultValue": "" 12 | } 13 | }, 14 | "resources": [ 15 | ], 16 | "outputs": { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /unit-tests/Password-params-must-be-secure/Fail/multiple.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | // there are other test cases that hit each scenario below, also want to make multiple are ok (outside of unit tests) 6 | "admin Password": { 7 | "type": "string" 8 | }, 9 | "adminPasswordObject": { 10 | "type": "Object" 11 | }, 12 | "password": { 13 | "type": "bool" 14 | } 15 | }, 16 | "resources": [] 17 | } -------------------------------------------------------------------------------- /arm-ttk/cache/AllImages.init.cache.ps1: -------------------------------------------------------------------------------- 1 | #TODO - don't think this cache is ever used 2 | exit 3 | 4 | $MyFile= $MyInvocation.MyCommand.ScriptBlock.File 5 | $myName = $MyFile | Split-Path -Leaf 6 | $myName = $myName -replace '\.init\.cache\.ps1' 7 | $myRoot = $MyFile | Split-Path 8 | $MyOutputFile = Join-Path $myRoot "$myName.cache.json" 9 | 10 | 11 | $images = az vm image list --all -o json | ConvertFrom-Json 12 | if (-not $images) { 13 | Write-Error "Could not list providers. You may not be logged in." 14 | return 15 | } 16 | 17 | $images | Sort-Object Urn | ConvertTo-Json -Depth 100 | Set-Content $MyOutputFile 18 | -------------------------------------------------------------------------------- /arm-ttk/testcases/deploymentTemplate/ManagedIdentityExtension-must-not-be-used.test.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Ensures that the ManagedIdentityExtension is not used. 4 | .Description 5 | Ensures that the ManagedIdentityExtension is not anywhere within template resources. 6 | #> 7 | param( 8 | [Parameter(Mandatory=$true,Position=0)] 9 | [PSObject] 10 | $TemplateObject 11 | ) 12 | 13 | $resourcesJson = $TemplateObject.resources | ConvertTo-Json -Depth 100 14 | 15 | if ($resourcesJson -match 'ManagedIdentityExtension') { 16 | Write-Error "Managed Identity Extension must not be used" -ErrorId ManagedIdentityExtension.Was.Used 17 | } -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Pass/InfoboxTooltipNotRequired/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | "name": "InfoBox", 9 | "type": "Microsoft.Common.InfoBox", 10 | "label": "InfoBoxes don't need tooltips" 11 | } 12 | ], 13 | "outputs": { 14 | "Location": "[location()]" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Pass/SectionTooltipNotRequired/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | "name": "Section31", 9 | "type": "Microsoft.Common.Section", 10 | "label": "Sections don't need tooltips" 11 | } 12 | ], 13 | "outputs": { 14 | "Location": "[location()]" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /unit-tests/URIs-Should-Be-Properly-Constructed/Pass/Concat-in-URL.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [], 5 | "outputs": { 6 | "ServerUrl": { 7 | "type": "string", 8 | "value": "[uri(concat('http://', reference(variables('publicIPAddressName')).dnsSettings.fqdn), 'somepath')]" 9 | }, 10 | "otherUri": { 11 | "type": "string", 12 | "value": "[uri(reference(resourceId('Microsoft.KeyVault/vaults/keys', 'keyVaultName', 'keyName'), '2021-06-01-preview').keyUri, 'blah')]" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /unit-tests/adminUsername-Should-Not-Be-A-Literal/Fail/Literal-Admin-Username.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "properties": { 6 | "osProfile": { 7 | "adminUserName": "NotRoot" 8 | }, 9 | "hardwareProfile": { 10 | "vmSize": "[parameters('vmSize')]" 11 | } 12 | }, 13 | "apiVersion": "2019-12-01", 14 | "type": "Microsoft.Compute/virtualMachines" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /unit-tests/Resources-Should-Not-Be-Ambiguous/Pass/top-level-child-expression.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "extensionName": "configScript", 6 | "resourceReference": "[resourceId('otherResourceGroup', 'Microsoft.Network/virtualMachines/extensions', 'vm', variable('extensionName'))]" 7 | }, 8 | "resources": [ 9 | { 10 | "type": "Microsoft.Compute/virtualMachines/extensions", 11 | "name": "[concat(parameters('vmName'), variable('extensionName')]" 12 | } 13 | ], 14 | "outputs": {} 15 | } 16 | -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Pass/TextBlockTooltipNotRequired/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | "name": "TextBlock1", 9 | "type": "Microsoft.Common.TextBlock", 10 | "label": "TextBlocks don't need tooltips" 11 | } 12 | ], 13 | "outputs": { 14 | "Location": "[location()]" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /arm-ttk/testcases/AllFiles/JSONFiles-Should-Be-Valid.test.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Ensures that all JSON files are valid 4 | .Description 5 | Ensures that all JSON files are valid syntax and can be imported. 6 | #> 7 | param( 8 | [PSObject[]] 9 | $FolderFiles 10 | ) 11 | 12 | foreach ($file in $FolderFiles) { 13 | if ($file.FullPath -notmatch '\.json(c)?$') { continue } 14 | $imported = Import-Json -FilePath $file.FullPath -ErrorAction SilentlyContinue -ErrorVariable ConvertIssue 15 | if (-not $imported) { 16 | Write-Error "Could not import '$($file.FullPath)'" -TargetObject $file.FullPath -ErrorId "Invalid.JSON" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /unit-tests/Location-Should-Be-In-Outputs/Fail/Location-Invalid/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/Location-Should-Be-In-Outputs/Fail/Location-Missing/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Not-Contain-Secrets/Fail/Outputs-Cannot-Contain-SecureObject-Parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "SecureObjectParam": { 6 | "type": "secureObject" 7 | }, 8 | "SecureObjectParamNotUsed": { 9 | "type": "secureObject" 10 | } 11 | }, 12 | "outputs": { 13 | "ContainsParamSecureObjectParam": { 14 | "type": "object", 15 | "value": "[concat( parameters ('SecureObjectParam')) ]" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Pass/EditableGridTooltipNotRequired/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | "name": "EditableGrid", 9 | "type": "Microsoft.Common.EditableGrid", 10 | "label": "Editable don't need tooltips" 11 | } 12 | ], 13 | "outputs": { 14 | "Location": "[location()]" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /unit-tests/Textboxes-Are-Well-Formed/Fail/Textboxes-Without-Regex/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Pass/SectionTooltipNotRequired/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Pass/bicep.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "metadata": { 5 | "_generator": { 6 | "name": "bicep", 7 | "version": "0.5.6.12127", 8 | "templateHash": "16815708176905569328" 9 | } 10 | }, 11 | "parameters": {}, 12 | "functions": [], 13 | "variables": {}, 14 | "resources": [], 15 | "outputs": { 16 | "oldIPReference": "[reference(resourceId('Microsoft.Network/publicIPAddresses', 'test'), '2015-06-15', 'Full')]" 17 | } 18 | } -------------------------------------------------------------------------------- /unit-tests/CommandToExecute-Must-Use-ProtectedSettings-For-Secrets/Fail/UnsecuredParameter.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "adminPassword": { 6 | "type": "securestring", 7 | "metadata": { 8 | "description": "Password or ssh key for the Virtual Machine." 9 | } 10 | } 11 | }, 12 | "resources": [ 13 | { 14 | "type": "Microsoft.Compute/virtualMachines/customScript", 15 | "settings": { 16 | "commandToExecute": "[parameters('adminPassword')]" 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /unit-tests/Textboxes-Are-Well-Formed/Fail/Textboxes-With-Invalid-Regex/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/Textboxes-Are-Well-Formed/Pass/Textboxes-With-Constrains-Regex/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/Validations-Must-Have-Message/Fail/Validations-Without-Message/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/Validations-Must-Have-Message/Pass/Validation-With-Message/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/adminUsername-Should-Not-Be-A-Literal/Fail/Literal-Admin-Username-SymbolicName.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": { 4 | "SymbolicResourceName": { 5 | "properties": { 6 | "osProfile": { 7 | "adminUserName": "NotRoot" 8 | }, 9 | "hardwareProfile": { 10 | "vmSize": "[parameters('vmSize')]" 11 | } 12 | }, 13 | "apiVersion": "2019-12-01", 14 | "type": "Microsoft.Compute/virtualMachines" 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /unit-tests/apiversions-should-be-recent/Pass/Nested-API-Version.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "type": "Microsoft.Storage/storageAccounts/blobServices/containers", 7 | "apiVersion": "2023-04-01", 8 | "name": "[format('{0}/default/{1}', variables('storageAccountName'), variables('blobContainerName'))]", 9 | "dependsOn": [ 10 | "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" 11 | ] 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Be-Present-In-Template-Parameters/Fail/MissingOutput/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/Resources-Should-Not-Be-Ambiguous/Pass/NestedResourceType.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "resourceReference": "[resourceId('otherResourceGroup', 'Microsoft.Network/virtualMachines/extensions', 'vm', 'configScript')]" 6 | }, 7 | "resources": [ 8 | { 9 | "type": "Microsoft.Compute/virtualMachines", 10 | "name": "vm", 11 | "resources": [ 12 | { 13 | "type": "extensions", 14 | "name": "configScript" 15 | } 16 | ] 17 | } 18 | ], 19 | "outputs": {} 20 | } 21 | -------------------------------------------------------------------------------- /unit-tests/Location-Should-Not-Be-Hardcoded/Fail/no-parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "name": "redisCache1", 7 | "type": "Microsoft.Cache/Redis", 8 | "apiVersion": "2019-07-01", 9 | "location": "[resourceGroup().location]", 10 | "properties": { 11 | "sku": { 12 | "name": "Basic", 13 | "family": "C", 14 | "capacity": 0 15 | } 16 | } 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /unit-tests/Textboxes-Are-Well-Formed/Fail/Textboxes-With-Invalid-Regex-Validations/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/Textboxes-Are-Well-Formed/Pass/Textboxes-With-Constrains-Validations/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/Textboxes-Are-Well-Formed/Pass/Textboxes-With-Length-Constrains-Regex/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/Textboxes-Are-Well-Formed/Pass/Textboxes-Without-Length-Constrains-Regex/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /arm-ttk/testcases/deploymentTemplate/providers_apiVersions-Is-Not-Permitted.test.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Ensures that resources cannot use an automatic apiVersion 4 | .Description 5 | Ensures that resources cannot porviders(*).apiVersions, as it can present instability. 6 | #> 7 | param( 8 | # The template text 9 | [Parameter(Mandatory=$true,Position=0)] 10 | [string] 11 | $TemplateText 12 | ) 13 | 14 | if ($TemplateText -like '*providers(*).apiVersions*') { # If the template text contains providers(*).apiVersions, fail 15 | Write-Error "providers().apiVersions is not permitted, use a literal apiVersion" -ErrorId ApiVersion.Using.Providers -TargetObject $TemplateText 16 | } -------------------------------------------------------------------------------- /unit-tests/Textboxes-Are-Well-Formed/Fail/Textboxes-Without-Constrains-ValidationMessage/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | } 12 | }, 13 | "variables": { 14 | }, 15 | "resources": [ 16 | ], 17 | "outputs": { 18 | "location": { 19 | "type": "string", 20 | "value": "[parameters('location')]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/artifacts-parameter/Fail/wrong-defaults/mainTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "_artifactsLocation": { 6 | "type": "string", 7 | "defaultValue": "http://myweb.com/" // this isn't valid for our repos 8 | }, 9 | "_artifactsLocationSasToken": { 10 | "type": "securestring", 11 | "defaultValue": "hard coded token" //this shouldn't be a default (use a param if needed) 12 | } 13 | }, 14 | "resources": [ 15 | ], 16 | "outputs": { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Fail/LocationValueNotAllowed/mainTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "allowedValues": [ 8 | "test" 9 | ] 10 | }, 11 | "createOrUpdate": { 12 | "type": "string", 13 | "allowedValues": [ 14 | "test" 15 | ] 16 | } 17 | }, 18 | "functions": [], 19 | "variables": {}, 20 | "resources": [], 21 | "outputs": {} 22 | } -------------------------------------------------------------------------------- /unit-tests/ResourceIds-should-not-contain/Pass/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | ], 6 | "outputs": { 7 | "bicepGenerated": { 8 | "type": "string", 9 | "value": "[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'RG1'), 'Microsoft.Resources/deployments', 'deployRG1')]" 10 | 11 | } 12 | }, 13 | "metadata": { 14 | "_generator": { 15 | "name": "bicep", 16 | "version": "0.3.1.62928", 17 | "templateHash": "229596444409662307" 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /unit-tests/apiversions-should-be-recent/Fail/preview-when-newer-is-available.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "apiVersion": "2017-12-01-preview", // there also exists a 2017-12-01-preview apiVersion... 6 | "type": "Microsoft.DBforMySQL/servers", 7 | "name": "db]", 8 | "location": "westeurope", 9 | "properties": { 10 | "administratorLogin": "sa", 11 | "administratorLoginPassword": "don't put passwords in plain text", 12 | "createMode": "Default", 13 | "sslEnforcement": "Disabled" 14 | } 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /unit-tests/adminUsername-Should-Not-Be-A-Literal/Fail/Literal-Variable-Username.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "variables": { 4 | "foo": "bar" 5 | }, 6 | "resources": [ 7 | { 8 | "properties": { 9 | "osProfile": { 10 | "adminUserName": "[variables('foo')]" 11 | }, 12 | "hardwareProfile": { 13 | "vmSize": "[parameters('vmSize')]" 14 | } 15 | }, 16 | "apiVersion": "2019-12-01", 17 | "type": "Microsoft.Compute/virtualMachines" 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Fail/preview-apiVersion-ReferencedByVariable.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": { 7 | "sqlServerName": "testSqlServer" 8 | }, 9 | "resources": [ 10 | { 11 | "name":"[variables('sqlServerName')]", 12 | "type":"Microsoft.DBforMySQL/servers" 13 | } 14 | ], 15 | "outputs": { 16 | "NonPreviewVersionWhereSamePreviewDateExists" : "[listkeys(variables('sqlServerName'), '2017-12-01-preview')]" 17 | } 18 | } -------------------------------------------------------------------------------- /arm-ttk/SampleWorkflow.yml: -------------------------------------------------------------------------------- 1 | 2 | on: 3 | push: 4 | jobs: 5 | RunTTK: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - name: Check out repository 9 | uses: actions/checkout@v2 10 | - name: Checkout TTK 11 | uses: actions/checkout@v2 12 | id: CheckoutTTK 13 | with: 14 | repository: Azure/arm-ttk 15 | path: ttk 16 | - name: RunTTK 17 | id: RunTTK 18 | shell: pwsh 19 | run: | 20 | Import-Module ./ttk/arm-ttk/ -Force -PassThru | Out-Host 21 | Get-ChildItem -Recurse -Filter *.json | 22 | Where-Object Path -notlike '*ttk*' | 23 | Test-AzTemplate 24 | 25 | 26 | -------------------------------------------------------------------------------- /arm-ttk/cache/README.md: -------------------------------------------------------------------------------- 1 | This directory contains cached information about Azure that is available to all tests. 2 | 3 | Files in this directory should match two patterns: 4 | 5 | 1. *.cache.json - These files contain cached data in unminified JSON. 6 | 2. *.init.cache.ps1 - These files refresh a .cache.json file. 7 | 8 | For example, AllResources.cache.json is created with AllResources.init.cache.json. 9 | 10 | To use this cache within TTK /testcases, add a parameter $AllResources. The test for [ApiVersions-Should-Be-Recent](../testcases/deploymentTemplate/apiVersions-Should-Be-Recent.test.ps1) contains an example. 11 | 12 | You can use Update-TTKCache to run all *.init.cache.ps1 files within the directory. 13 | -------------------------------------------------------------------------------- /unit-tests/Template-Should-Not-Contain-Blanks/Fail/Blanks-In-Config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]" 8 | } 9 | }, 10 | "resources": [ 11 | { 12 | "type": "Microsoft.Web/sites/config", 13 | "name": "[concat(variables('AppServiceName'), '/appsettings')]", 14 | "apiVersion": "2020-09-01", 15 | "location": "[parameters('location')]", 16 | "foo": "" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /unit-tests/adminPassword-Should-Not-Be-A-Literal/Pass/ExpressionValue.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "deploymentName": "Deployment-1.0" 6 | }, 7 | "resources": [ 8 | { 9 | "properties": { 10 | "parameters": { 11 | "adminPassword": { 12 | "value": "[reference(resourceId('Microsoft.Resources/deployments', variables('deploymentName')), '2019-10-01').outputs.accountSettings.value.accountAdminName]" 13 | } 14 | } 15 | } 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /unit-tests/adminUsername-Should-Not-Be-A-Literal/Pass/ExpressionValue.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "deploymentName": "Deployment-1.0" 6 | }, 7 | "resources": [ 8 | { 9 | "properties": { 10 | "parameters": { 11 | "adminUsername": { 12 | "value": "[reference(resourceId('Microsoft.Resources/deployments', variables('deploymentName')), '2019-10-01').outputs.accountSettings.value.accountAdminName]" 13 | } 14 | } 15 | } 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /unit-tests/DeploymentTemplate-Schema-Is-Correct/Fail/NestedTemplate-Without-Schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string" 7 | } 8 | }, 9 | "resources": [ 10 | { 11 | "type": "Microsoft.Resources/deployments", 12 | "apiVersion": "2019-10-01", 13 | "name": "vmDeploy", 14 | "properties": { 15 | "expressionEvaluationOptions": { 16 | "scope": "inner" 17 | }, 18 | "mode": "Incremental", 19 | "template": { 20 | "contentVersion": "1.0.0.0" 21 | } 22 | } 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /arm-ttk/testcases/deploymentParameters/DeploymentParameters-Should-Have-Parameters.test.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Ensures that parameters file has parameters 4 | .Description 5 | Ensures that parameters file has parameters 6 | If a parameters file has no '.parameters' property or any other properties then it has no parameters. 7 | #> 8 | param( 9 | # The parameter object 10 | [Parameter(Mandatory=$true,Position=0)] 11 | [PSObject] 12 | $ParameterObject 13 | ) 14 | 15 | if (-not $ParameterObject.'$schema' -and -not $ParameterObject.contentVersion) { 16 | return 17 | } 18 | 19 | if (-not $ParameterObject.parameters) { 20 | Write-Error -ErrorId Parameters.Missing.Parameters -Message "No parameters exists" 21 | } -------------------------------------------------------------------------------- /unit-tests/Password-Textboxes-Must-Be-Used-For-Password-Parameters/Fail/NotSecureString/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | }, 12 | "MyPassword": { 13 | "type": "string" 14 | } 15 | }, 16 | "variables": { 17 | }, 18 | "resources": [ 19 | ], 20 | "outputs": { 21 | "location": { 22 | "type": "string", 23 | "value": "[parameters('location')]" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /unit-tests/Virtual-Machines-Should-Not-Be-Preview/Fail/Latest-Preview-offer.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "type": "Microsoft.Compute/virtualMachines", 6 | "apiVersion": "2019-12-01", 7 | "properties": { 8 | "storageProfile": { 9 | "imageReference": { 10 | "publisher": "Canonical", 11 | "version": "latest", 12 | "offer": "UbuntuServer_preview", 13 | "sku": "16.04-LTS" 14 | } 15 | } 16 | } 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /unit-tests/Virtual-Machines-Should-Not-Be-Preview/Fail/Latest-Preview-sku.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "type": "Microsoft.Compute/virtualMachines", 6 | "apiVersion": "2019-12-01", 7 | "properties": { 8 | "storageProfile": { 9 | "imageReference": { 10 | "publisher": "Canonical", 11 | "version": "latest", 12 | "offer": "UbuntuServer", 13 | "sku": "16.04-LTS-preview" 14 | } 15 | } 16 | } 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /unit-tests/Tooltips-Should-Be-Present/Fail/MissingTooltip/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | "name": "TextBox1", 9 | "type": "Microsoft.Common.TextBox", 10 | "label": "Textboxes Without Tooltip", 11 | "constraints": { 12 | "required": true 13 | } 14 | } 15 | ], 16 | "outputs": { 17 | "Location": "[location()]" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /unit-tests/Virtual-Machines-Should-Not-Be-Preview/Fail/Latest-Preview-version.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "type": "Microsoft.Compute/virtualMachines", 6 | "apiVersion": "2019-12-01", 7 | "properties": { 8 | "storageProfile": { 9 | "imageReference": { 10 | "publisher": "Canonical", 11 | "version": "latest-preview", 12 | "offer": "UbuntuServer", 13 | "sku": "16.04-LTS" 14 | } 15 | } 16 | } 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /unit-tests/Virtual-Machines-Should-Not-Be-Preview/Pass/virtualmachinescalesets.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "type": "Microsoft.Compute/virtualMachineScaleSets", 7 | "apiVersion": "2020-06-01", 8 | "name": "foo", 9 | "properties": { 10 | "virtualMachineProfile": { 11 | "storageProfile": { 12 | "imageReference": { 13 | "version": "string" 14 | } 15 | } 16 | } 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /unit-tests/Parameters-Without-Default-Must-Exist-In-CreateUIDefinition/Fail/MissingCreateUIParameter/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | }, 12 | "MyParameter": { 13 | "type": "string" 14 | } 15 | }, 16 | "variables": { 17 | }, 18 | "resources": [ 19 | ], 20 | "outputs": { 21 | "location": { 22 | "type": "string", 23 | "value": "[parameters('location')]" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /unit-tests/apiversions-should-be-recent/Pass/NonPreviewVersionWhereSamePreviewDateExists.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "resources": [ 4 | { 5 | "apiVersion": "2017-12-01", // there also exists a 2017-12-01-preview apiVersion... 6 | "type": "Microsoft.DBforMySQL/servers", 7 | "name": "[variables('databaseName')]", 8 | "location": "[parameters('location')]", 9 | "properties": { 10 | "administratorLogin": "[variables('databaseLoginName')]", 11 | "administratorLoginPassword": "[variables('databaseLoginPassword')]", 12 | "createMode": "Default", 13 | "sslEnforcement": "Disabled" 14 | } 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /unit-tests/adminUsername-Should-Not-Be-A-Literal/Fail/Literal-Variable-Property-Username.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "variables": { 4 | "foo": { 5 | "username": "bar" 6 | } 7 | }, 8 | "resources": [ 9 | { 10 | "properties": { 11 | "osProfile": { 12 | "adminUserName": "[variables('foo')].username" 13 | }, 14 | "hardwareProfile": { 15 | "vmSize": "[parameters('vmSize')]" 16 | } 17 | }, 18 | "apiVersion": "2019-12-01", 19 | "type": "Microsoft.Compute/virtualMachines" 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /unit-tests/apiversions-should-be-recent/Fail/not-a-string.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [ 8 | { 9 | "name": "publicIPAddress1", 10 | "type": "Microsoft.Network/publicIPAddresses", 11 | "apiVersion": true, 12 | "location": "[resourceGroup().location]", 13 | "tags": { 14 | "displayName": "publicIPAddress1" 15 | }, 16 | "properties": { 17 | "publicIPAllocationMethod": "Dynamic" 18 | } 19 | } 20 | ], 21 | "outputs": {} 22 | } -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Pass/MultiSelectAllowed/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | }, 12 | "couchbaseServices": { 13 | "type": "array", 14 | "defaultValue": [ "data", "index", "query" ] 15 | } 16 | }, 17 | "variables": {}, 18 | "resources": [], 19 | "outputs": { 20 | "location": { 21 | "type": "string", 22 | "value": "[parameters('location')]" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Be-Present-In-Template-Parameters/Warn/OutputIncorrectType/azureDeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "testBoolean": { 6 | "type": "bool", 7 | "defaultValue": false, 8 | "metadata":{ 9 | "description": "A Boolean Parameter" 10 | } 11 | }, 12 | "location": { 13 | "type": "string", 14 | "defaultValue": "[resourceGroup().location]", 15 | "metadata": { 16 | "description": "Location for all resources." 17 | } 18 | } 19 | }, 20 | "resources": [] 21 | } -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Fail/ValueNotAllowed/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | }, 12 | "ComboBox": { 13 | "allowedValues": [ 14 | "1", 15 | "2" 16 | ] 17 | } 18 | }, 19 | "variables": { 20 | }, 21 | "resources": [ 22 | ], 23 | "outputs": { 24 | "location": { 25 | "type": "string", 26 | "value": "[parameters('location')]" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /unit-tests/apiversions-should-be-recent/Fail/old-apiVersion.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [ 8 | { 9 | "name": "publicIPAddress1", 10 | "type": "Microsoft.Network/publicIPAddresses", 11 | "apiVersion": "2015-06-15", 12 | "location": "[resourceGroup().location]", 13 | "tags": { 14 | "displayName": "publicIPAddress1" 15 | }, 16 | "properties": { 17 | "publicIPAllocationMethod": "Dynamic" 18 | } 19 | } 20 | ], 21 | "outputs": {} 22 | } -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Pass/LocationValueAllowed/mainTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "allowedValues": [ 8 | "test", 9 | "eastus", 10 | "eastus2", 11 | "southcentralus" 12 | ] 13 | }, 14 | "createOrUpdate": { 15 | "type": "string", 16 | "allowedValues": [ 17 | "test" 18 | ] 19 | } 20 | }, 21 | "functions": [], 22 | "variables": {}, 23 | "resources": [], 24 | "outputs": {} 25 | } -------------------------------------------------------------------------------- /unit-tests/IDs-Should-Be-Derived-From-ResourceIDs/Pass/IDs-In-AppSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json", 3 | "contentVersion": "1.0.0.0", 4 | "variables": {}, 5 | "resources": [ 6 | { 7 | "type": "Microsoft.Web/sites/config", 8 | "name": "[concat(variables('AppServiceName'), '/appsettings')]", 9 | "apiVersion": "2020-09-01", 10 | "location": "[parameters('location')]", 11 | "dependsOn": [ 12 | "[variables('AppServiceName')]" 13 | ], 14 | "properties": { 15 | "SOMEONES_ID": "495f6d91-cceb-4916-bf29-c07bea002443" 16 | } 17 | } 18 | ], 19 | "outputs": {} 20 | } -------------------------------------------------------------------------------- /unit-tests/IDs-Should-Be-Derived-From-ResourceIDs/Pass/IDs-In-KeyVault.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "type": "Microsoft.Web/certificates", 7 | "name": "[parameters('certificateOrderName')]", 8 | "apiVersion": "2015-08-01", 9 | "location": "[parameters('existingAppLocation')]", 10 | 11 | "properties": { 12 | "keyVaultId": "[parameters('existingKeyVaultId')]", // there are a number of different resources that use this property name 13 | "keyVaultSecretName": "[parameters('certificateOrderName')]" 14 | } 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /unit-tests/DependsOn-Best-Practices/Pass/dependson-nested-if.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "resources": [ 5 | { 6 | "name": "publicIPAddress1", 7 | "type": "Microsoft.Network/publicIPAddresses", 8 | "apiVersion": "2019-11-01", 9 | "location": "[resourceGroup().location]", 10 | "dependsOn": [ 11 | "[resourceId('Microsoft.Storage/storageAccounts', concat('foo', if(bool('true'), 'bar', 'baz')))]" // if is allowed if not at the beginnig 12 | ], 13 | "properties": { 14 | "publicIPAllocationMethod": "Dynamic" 15 | } 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /unit-tests/IDs-Should-Be-Derived-From-ResourceIDs/Pass/documentdb-sqldatabases-that-contains-resource-id-should-pass.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [ 8 | { 9 | "name": "dbAccount/dbName", 10 | "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases", 11 | "apiVersion": "2021-04-15", 12 | "location": "eastus", 13 | "tags": {}, 14 | "properties": { 15 | "resource": { 16 | "id": "dbName" 17 | } 18 | } 19 | } 20 | ], 21 | "outputs": {} 22 | } -------------------------------------------------------------------------------- /unit-tests/Textboxes-Are-Well-Formed/Fail/Textboxes-Without-Regex/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | "name": "TextBox1", 9 | "type": "Microsoft.Common.TextBox", 10 | "label": "Textboxes Without Regex", 11 | "toolTip": "Textboxes without regex.", 12 | "constraints": { 13 | "required": true 14 | } 15 | } 16 | ], 17 | "outputs": { 18 | "Location": "[location()]" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Fail/MultiSelectWithBadValue/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | }, 12 | "couchbaseServices": { 13 | "type": "array", 14 | "defaultValue": [ "data", "index", "query", "ThisIsNotAValidValue" ] 15 | } 16 | }, 17 | "variables": {}, 18 | "resources": [], 19 | "outputs": { 20 | "location": { 21 | "type": "string", 22 | "value": "[parameters('location')]" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /unit-tests/apiversions-should-be-recent/Fail/api-version-is-an-expression.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [ 8 | { 9 | "name": "publicIPAddress1", 10 | "type": "Microsoft.Network/publicIPAddresses", 11 | "apiVersion": "[concat('2020', '01-01')]", 12 | "location": "[resourceGroup().location]", 13 | "tags": { 14 | "displayName": "publicIPAddress1" 15 | }, 16 | "properties": { 17 | "publicIPAllocationMethod": "Dynamic" 18 | } 19 | } 20 | ], 21 | "outputs": {} 22 | } -------------------------------------------------------------------------------- /arm-ttk/testcases/CreateUIDefinition/Usernames-Should-Not-Have-A-Default.test.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Ensure that Usernames do not have a default 4 | .Description 5 | Ensure that Usernames do not have a default 6 | #> 7 | 8 | param( 9 | [Parameter(Mandatory=$true)] 10 | [PSObject] 11 | $CreateUIDefinitionObject 12 | ) 13 | 14 | # First, find al user name text boxes. 15 | $userNameTextBoxes = 16 | $CreateUIDefinitionObject | 17 | Find-JsonContent -Key type -Value Microsoft.Compute.UserNameTextBox 18 | 19 | foreach ($tb in $userNameTextBoxes) { # Then walk thru each text box, 20 | if ($tb.defaultValue) { # if it contained a default value, 21 | # write an error. 22 | Write-Error "Username textbox $($tb.Name) should not have a default value" -TargetObject $tb 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /arm-ttk/testcases/deploymentTemplate/Resources-Should-Have-Location.test.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | TODO: summary of test 4 | .Description 5 | TODO: describe this test 6 | #> 7 | 8 | param( 9 | [Parameter(Mandatory = $true, Position = 0)] #not mandatory for case of an empty resource array 10 | [PSObject]$TemplateObject 11 | ) 12 | 13 | foreach ($r in $TemplateObject.Resources) { 14 | foreach ($resource in @(@($r) + $r.ParentResources)) { 15 | if ($resource.Location) { 16 | $location = "$($resource.location)".Trim() 17 | if ($location -notmatch '^\[.*\]$' -and $location -ne 'global') { 18 | Write-Error "Resource $($resource.Name) Location must be an expression or 'global'" -TargetObject $resource 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /unit-tests/Virtual-Machines-Should-Not-Be-Preview/Fail/StorageProfile-In-Variable.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "variables": { 4 | "storage": { 5 | "imageReference": { 6 | "publisher": "Canonical", 7 | "version": "latest-preview", 8 | "offer": "UbuntuServer", 9 | "sku": "16.04-LTS" 10 | } 11 | } 12 | }, 13 | "resources": [ 14 | { 15 | "type": "Microsoft.Compute/virtualMachines", 16 | "name": "test", 17 | "apiVersion": "2019-12-01", 18 | "properties": { 19 | "storageProfile": "[Variables('storage')]" 20 | } 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/_arm-ttk-module/Test-AzTemplates.tests.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Tests for Test-AzTemplate 4 | .Description 5 | Tests for core functionality of Test-AzTemplate. 6 | #> 7 | 8 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path 9 | Push-Location $here 10 | 11 | describe AllFiles { 12 | it 'Can run tests on all files by passing -GroupName AllFiles' { 13 | $pwd | 14 | Split-Path | 15 | Join-Path -ChildPath Common | 16 | Join-Path -ChildPath Pass | 17 | Join-Path -ChildPath 100-marketplace-sample | 18 | Get-Item| 19 | Test-AzTemplate -GroupName AllFiles -Test 'JSONFiles-Should-Be-Valid' | 20 | Select-Object -ExpandProperty Passed | 21 | Should -Be $true 22 | } 23 | } 24 | Pop-Location 25 | -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Fail/OutputMismatch/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | }, 12 | "applianceCount": { 13 | "type": "int", 14 | "defaultValue": 1, 15 | "metadata": { 16 | "description": "Number of Appliances" 17 | } 18 | } 19 | }, 20 | "variables": {}, 21 | "resources": [], 22 | "outputs": { 23 | "location": { 24 | "type": "string", 25 | "value": "[parameters('location')]" 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Pass/ValueAllowed/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | }, 12 | "applianceCount": { 13 | "type": "int", 14 | "defaultValue": 1, 15 | "metadata": { 16 | "description": "Number of Appliances" 17 | } 18 | } 19 | }, 20 | "variables": {}, 21 | "resources": [], 22 | "outputs": { 23 | "location": { 24 | "type": "string", 25 | "value": "[parameters('location')]" 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /unit-tests/Template-Should-Not-Contain-Blanks/Pass/Blanks-In-Config-AppSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]" 8 | } 9 | }, 10 | "resources": [ 11 | { 12 | "type": "Microsoft.Web/sites/config", 13 | "name": "[concat(variables('AppServiceName'), '/appsettings')]", 14 | "apiVersion": "2020-09-01", 15 | "location": "[parameters('location')]", 16 | "properties": { 17 | "SIGNAL_TO_SOMEBODY_THAT_DEFAULT_VALUE_IS_EMPTY": "" 18 | } 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /unit-tests/adminUsername-Should-Not-Be-A-Literal/Fail/Literal-Admin-AdminLogin.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "administratorLogin": "fixedusername", 6 | "administratorLoginPassword": "fixedpassword" 7 | }, 8 | "resources": [ 9 | { 10 | "type": "Microsoft.DBforMySQL/flexibleServers", 11 | "apiVersion": "2021-05-01", 12 | "name": "name", 13 | "location": "location", 14 | "properties": { 15 | "administratorLogin": "[variables('administratorLogin')]", 16 | "administratorLoginPassword": "[variables('administratorLoginPassword')]" 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Pass/ValueAllowedInSteps/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | }, 12 | "applianceCount": { 13 | "type": "int", 14 | "defaultValue": 1, 15 | "metadata": { 16 | "description": "Number of Appliances" 17 | } 18 | } 19 | }, 20 | "variables": {}, 21 | "resources": [], 22 | "outputs": { 23 | "location": { 24 | "type": "string", 25 | "value": "[parameters('location')]" 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /unit-tests/Variables-Must-Be-Referenced/Pass/Variable-Copy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "foo": { 5 | "type": "string", 6 | "defaultValue": "[variables('allDisks')]" 7 | } 8 | }, 9 | "variables": { 10 | "disks": { 11 | "copy": [ 12 | { 13 | "name": "diskConfig", 14 | "count": 2, 15 | "input": { 16 | "name": "[format('metadisk-{0,2:D2}', copyIndex('diskConfig',1))]", 17 | "diskSizeGB": "120" 18 | } 19 | } 20 | ] 21 | }, 22 | "allDisks": "[variables('disks').diskConfig]" 23 | } 24 | } -------------------------------------------------------------------------------- /unit-tests/adminPassword-Should-Not-Be-A-Literal/Fail/Literal-Admin-AdminPassword.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "variables": { 5 | "administratorLogin": "fixedusername", 6 | "administratorLoginPassword": "fixedpassword" 7 | }, 8 | "resources": [ 9 | { 10 | "type": "Microsoft.DBforMySQL/flexibleServers", 11 | "apiVersion": "2021-05-01", 12 | "name": "name", 13 | "location": "location", 14 | "properties": { 15 | "administratorLogin": "[variables('administratorLogin')]", 16 | "administratorLoginPassword": "[variables('administratorLoginPassword')]" 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /unit-tests/PasswordBoxes-Must-Have-Min-Length/Pass/No-Regex-Constraint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Compute.MultiVm", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | "name": "dbAdminPassword", 9 | "type": "Microsoft.Common.PasswordBox", 10 | "label": { 11 | "password": "Password", 12 | "confirmPassword": "Confirm password" 13 | }, 14 | "toolTip": "Admin password for the database", 15 | "constraints": { 16 | "required": true 17 | }, 18 | "options": { 19 | "hideConfirmation": false 20 | }, 21 | "visible": true 22 | } 23 | ], 24 | "steps": [] 25 | } 26 | } -------------------------------------------------------------------------------- /unit-tests/Allowed-Values-Should-Actually-Be-Allowed/Pass/ValueAllowedInStepsSection/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "[resourceGroup().location]", 8 | "metadata": { 9 | "description": "Location for all resources." 10 | } 11 | }, 12 | "applianceCount": { 13 | "type": "int", 14 | "defaultValue": 1, 15 | "metadata": { 16 | "description": "Number of Appliances" 17 | } 18 | } 19 | }, 20 | "variables": {}, 21 | "resources": [], 22 | "outputs": { 23 | "location": { 24 | "type": "string", 25 | "value": "[parameters('location')]" 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Not-Contain-Secrets/Pass/Outputs-Can-Contain-Incomplete-Expression-References.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "SecureStringParam2": { 6 | "type": "secureString" 7 | }, 8 | "SecureObjectParam": { 9 | "type": "secureObject" 10 | }, 11 | "SecureObjectParamNotUsed": { 12 | "type": "secureObject" 13 | } 14 | }, 15 | "variables": { 16 | }, 17 | "resources": [ 18 | ], 19 | "outputs": { 20 | "NotContainsSecureObjectParam": { 21 | "type": "object", 22 | "value": "parameters ('SecureObjectParamNotUsed') ]" // TODO add [[ 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /unit-tests/DeploymentParameters-Should-Have-Value/Pass/HasValid.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "someKey" : { 6 | "value" : "some data" 7 | }, 8 | "someObject" : { 9 | "value" : {} 10 | }, 11 | "someBool" : { 12 | "value" : true 13 | }, 14 | "someInt" : { 15 | "value" : 1 16 | }, 17 | "someKeyVaultReference": { 18 | "reference": { 19 | "keyVault": { 20 | "id": "/subscriptions/00000000-abcd-ef12-ABCD-EF3456789000/resourceGroups/rg1/providers/Microsoft.KeyVault/vaults/myvault" 21 | }, 22 | "secretName": "ExamplePassword" 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /unit-tests/Secure-String-Parameters-Cannot-Have-Default.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "pass": { 6 | "type": "securestring" 7 | }, 8 | "pass2": { 9 | "type": "SecureString", 10 | "defaultValue": "" 11 | }, 12 | "pass3": { 13 | "type": "securestring", 14 | "defaultValue": "[newGuid()]" 15 | }, 16 | "pass4": { 17 | "type": "securestring", 18 | "defaultValue": "[ newGuid() ]" 19 | }, 20 | "fail": { 21 | "type": "securestring", 22 | "defaultValue": "secret" 23 | } 24 | }, 25 | "variables": { }, 26 | "resources": [ 27 | ] 28 | } -------------------------------------------------------------------------------- /unit-tests/apiversions-should-be-recent/Pass/old-apiVersion-skipped.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [ 8 | { 9 | "metadata": ["disable-apiVersions-should-be-recent"], 10 | "name": "publicIPAddress1", 11 | "type": "Microsoft.Network/publicIPAddresses", 12 | "apiVersion": "2015-06-15", 13 | "location": "[resourceGroup().location]", 14 | "tags": { 15 | "displayName": "publicIPAddress1" 16 | }, 17 | "properties": { 18 | "publicIPAllocationMethod": "Dynamic" 19 | } 20 | } 21 | ], 22 | "outputs": {} 23 | } -------------------------------------------------------------------------------- /unit-tests/Password-Textboxes-Must-Be-Used-For-Password-Parameters/Fail/NotSecureString/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | "name": "PasswordBox", 9 | "type": "Microsoft.Common.PasswordBox", 10 | "label": "PasswordBox", 11 | "toolTip": "A Password Box", 12 | "constraints": { 13 | "required": true 14 | } 15 | } 16 | ], 17 | "outputs": { 18 | "Location": "[location()]", 19 | "MyPassword": "[basics('PasswordBox')]" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /unit-tests/IDs-Should-Be-Derived-From-ResourceIDs/Fail/documentdb-sqldatabases-that-contains-invalid-id-property-should-fail.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": {}, 5 | "functions": [], 6 | "variables": {}, 7 | "resources": [ 8 | { 9 | "name": "dbAccount/dbName", 10 | "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases", 11 | "apiVersion": "2021-04-15", 12 | "location": "eastus", 13 | "tags": {}, 14 | "properties": { 15 | "resource": { 16 | "id": "dbName" 17 | }, 18 | "id": "this is not excluded from verification" 19 | } 20 | } 21 | ], 22 | "outputs": {} 23 | } -------------------------------------------------------------------------------- /unit-tests/Location-Should-Not-Be-Hardcoded/Pass/Location-In-Parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 3 | "parameters": { 4 | "storagelocation": { 5 | "type": "string", 6 | "defaultValue": "[resourceGroup().location]", 7 | "metadata": { 8 | "description": "Azure region to deploy the storage account to. Defaults to resource group location." 9 | } 10 | } 11 | }, 12 | "variables": {}, 13 | "resources": [ 14 | { 15 | "apiVersion": "2019-06-01", 16 | "location": "[parameters('storageLocation')]", 17 | "type": "Microsoft.Storage/storageAccounts", 18 | "identity": { 19 | "type": "SystemAssigned" 20 | } 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Be-Present-In-Template-Parameters/Pass/OutputCorrectType/azureDeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "swarmRootdiskSize": { 6 | "type": "int", 7 | "minValue": 30, 8 | "maxValue": 2048, 9 | "defaultValue": 30, 10 | "metadata": { 11 | "description": "Please select the size of the data disk you wish to deploy (value is integer GB)." 12 | } 13 | }, 14 | "location": { 15 | "type": "string", 16 | "defaultValue": "[resourceGroup().location]", 17 | "metadata": { 18 | "description": "Location for all resources." 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /unit-tests/artifacts-parameter/Pass/raw-repo-path/mainTemplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "_artifactsLocation": { 6 | "type": "securestring", //this type is ok, so is the defaultValue (if you pass in the params) 7 | // unit tests can't do this yet 8 | //"defaultValue": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/sample-path-for-unit-tests-do-not-change/" 9 | "defaultValue": "[deployment().properties.templateLink.uri]" 10 | }, 11 | "_artifactsLocationSasToken": { 12 | "type": "securestring", 13 | "defaultValue": "" 14 | } 15 | }, 16 | "resources": [ 17 | ], 18 | "outputs": { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /unit-tests/Usernames-Should-Not-Have-A-Default/Fail/DefaultUsername/createUiDefinition.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Azure.CreateUIDef", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | "name": "adminUsername", 9 | "type": "Microsoft.Compute.UserNameTextBox", 10 | "label": "Username", 11 | "defaultValue": "root", 12 | "toolTip": "Admin username for the machine", 13 | "osPlatform": "Linux", 14 | "constraints": { 15 | "required": true 16 | } 17 | } 18 | ], 19 | "outputs": { 20 | "Location": "[location()]" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /unit-tests/Outputs-Must-Be-Present-In-Template-Parameters/Pass/type-mismatch-int/azureDeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "swarmRootdiskSize": { 6 | "type": "int", 7 | "minValue": 30, 8 | "maxValue": 2048, 9 | "defaultValue": 30, 10 | "metadata": { 11 | "description": "Please select the size of the data disk you wish to deploy (value is integer GB)." 12 | } 13 | }, 14 | "location": { 15 | "type": "string", 16 | "defaultValue": "[resourceGroup().location]", 17 | "metadata": { 18 | "description": "Location for all resources." 19 | } 20 | } 21 | }, 22 | "resources": [] 23 | } -------------------------------------------------------------------------------- /unit-tests/PasswordBoxes-Must-Have-Min-Length/Fail/No-Min-Constraint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Compute.MultiVm", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | "name": "dbAdminPassword", 9 | "type": "Microsoft.Common.PasswordBox", 10 | "label": { 11 | "password": "Password", 12 | "confirmPassword": "Confirm password" 13 | }, 14 | "toolTip": "Admin password for the database", 15 | "constraints": { 16 | "required": true, 17 | "regex": "^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)[A-Za-z\\d]" 18 | }, 19 | "options": { 20 | "hideConfirmation": false 21 | }, 22 | "visible": true 23 | } 24 | ], 25 | "steps": [] 26 | } 27 | } -------------------------------------------------------------------------------- /unit-tests/PasswordBoxes-Must-Have-Min-Length/Pass/Has-Complex-Constraint2.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", 3 | "handler": "Microsoft.Compute.MultiVm", 4 | "version": "0.1.2-preview", 5 | "parameters": { 6 | "basics": [ 7 | { 8 | "name": "adminPassword", 9 | "type": "Microsoft.Common.PasswordBox", 10 | "label": { 11 | "password": "password", 12 | "confirmPassword": "Confirm password" 13 | }, 14 | "constraints": { 15 | "required": true, 16 | "regex": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}$", 17 | "validationMessage": "Password must be at least 12 characters long" 18 | }, 19 | "options": { 20 | "hideConfirmation": false 21 | } 22 | } 23 | ], 24 | "steps": [] 25 | } 26 | } --------------------------------------------------------------------------------