I have an issue with ARM templates where, when there is an error, it will always say line 1.
##[error]Deployment template validation failed: 'The template resource at line '1' and column '3276'
is not valid: The template function 'reference' is not expected at this location. Please see
https://aka.ms/arm-template-expressions for usage details..
My ARM template clearly has more lines than 1. This makes troubleshooting very hard. How do I save the file so that is has more lines when an error occures??
Additional information
Deploy method: YAML (Azure DevOps)
- task: AzureResourceManagerTemplateDeployment#3
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: ***
subscriptionId: ***
action: 'Create Or Update Resource Group'
resourceGroupName: ***
location: 'West Europe'
templateLocation: 'Linked artifact'
csmFile: 'pipelines/azuredeploy.json'
csmParametersFile: 'pipelines/azuredeploy.parameters.json'
deploymentMode: 'Incremental'
deploymentName: 'AzureDeployment-$(fullversion)'
Encoding used: UTF-8
End of line sequence: CRLF
Thank you very much in advance.
According to the error, you do not use the Azure ARM template function reference in the right location. In fact, the reference function just can be used in the properties of a resource definition and the outputs section of a template or deployment. For more details, please refer to the document
Besides, you can use the Powershell command Test-AzResourceGroupDeployment -debug to debug your ARM template.
Related
In Robot Framework, when you create a custom keyword using the *** Keyword *** section of .robot file, is there a way to print an INFO message in the log file? I've tried using BuiltIn.Log keyword, but it creates a new keyword section where the INFO is written.
I want to get INFO in custom keyword this way:
Info in Keyword execution
But currently, my only option is: Info inside BuiltIn.Log definition
Is there a way to add INFO directly to my custom keyword without using Python API?
Did you try Log to console Typing text ${User} into text field 'username' like this?
To my knowledge what you are attempting, is unfortunately not doable. This way of embedding messages can be done by the robot.logger or Python's logging api - More info in the Robot Framework User Guide
However in addition to using the Log keyword, you may alleviate the need by first adding a documentation string on your keywords - the first line is always shown in the Documentation section of the keyword. Additionally by enabling Trace on the log file you'll get at least the Arguments and Return values shown on each keyword.
The Documentation is added with the [Documentation] tag similar to
Custom Keyword
[Documentation] This string is shown completely until I leave at least
... One empty row.
...
... This is shown only in the library documentation file.
And logging modes are changed with a launch option -L or --loglevel, to enable Trace mode, simply add the option when launching your robot.
robot -t TestName -s SuiteName -L TRACE .\Path\to\Tests
I have used an ARM Template to deploy a Microsoft.Maps/account resource to Azure.
That was successful:
Resource Microsoft.Maps/accounts 'nzmoebasedemo0000bt' provisioning status is succeeded
I'd like to retrieve the Primary key generated, within the ARM template, in order to persist it to a KeyVault.
I looked in https://resource.azure.com but the Maps/account provider was not listed, so could find no hint as to what property to read.
I tried:
[listKeys(resourceId('Microsoft.Maps/account', 'parameters('keyVaultVaultSecretMapsAccountResourceName')'), providers('Microsoft.Maps', 'account').apiVersions[0]).keys[0].value]"
Abd got back:
#{parameters=; status=Trial run failed. ; outputs=; provisionStateSucceeded=False; deploymentOutput=; errorCode=InvalidTemplate; errorMessage=Deployment template validation failed: 'The template resource 'azure.arm.base.keyVault.vault.secret' at line '168' and column '9' is not valid: Unable to evaluate template language function 'providers': function requires the second argument to be a multi-segmented resource type excluding the resource provider namespace. Invalid function argument 'account'. Please see https://aka.ms/arm-template-expressions/#providers for usage details.. Please see https://aka.ms/arm-template-expressions for usage details.'.}
Which in this case...seems incorrect.
What am I not seeing/getting?
Thanks!
Edit:
As per suggestion given, the following did pass a test run.
"[listKeys(resourceId('Microsoft.Maps/account', parameters('keyVaultVaultSecretMapsAccountResourceName')), '2018-05-01').keys[0].value]"
But when actually run, got the following:
1:02:35 AM - Resource Microsoft.Maps/account 'nzmoebasedemo0000bt' failed with message '{
"error": {
"code": "InvalidResourceType",
"message": "The resource type could not be found in the namespace 'Microsoft.Maps' for api version '2018-05-01'."
}
}'
Edit again:
As per guidance given in the comments, the following works! (after correcting api version, spelling mistake, and using 'primaryKey' property:
"[listKeys(resourceId('Microsoft.Maps/accounts', parameters('keyVaultVaultSecretMapsAccountsResourceName')), '2018-05-01').primaryKey]"
So the problem was due to a typo, the provider\resource is Microsoft.Maps/accounts
Is there some configuration setting that I must perform to get Robot Framework (RF) to run Gherkin/BDD style test cases?
I have installed RF 2.8.3 on Windows 7 and is running OK with Selenium2Library and DatabaseLibrary. According to the user docs and other info on the web, I should be able to write and run Gherkin style tests. However, when I do this, I get errors. RF does not strip the Gherkin keywords (Given, When, Then, ...) before trying to match the keyword:
Tests.Group001 GeneralTests
==============================================================================
Scenario: No template operation selected | FAIL |
No keyword with name 'But page does not contain a no template operation selected error message' found.
------------------------------------------------------------------------------
I run the tests using a straight-forward:
pybot ../Tests
My sample test file is:
*** settings ***
Library Selenium2Library
Library DatabaseLibrary
Library kw_common
*** Test Cases ***
Scenario: No template operation selected
Given I have logged in and I have selected to perform template configuration
When I do not select a template operation
But page does not contain a no template operation selected error message
And I press the next button
Then I should not see a template operation selected error message
*** Keywords ***
I have logged in and I have selected to perform template configuration
Log Given I have logged in and I have selected to perform template configuration
I do not select a template operation
Log No template operation selected
page does not contain a no template operation selected error message
Page Should Not Contain 'ddTemplateOperation' is required.
I press the next button
Click Element xpath=//input[contains(#id,'next')]
I should not see a template operation selected error message
Page Should Contain 'ddTemplateOperation' is required.
Help would be much appreciated. Thanks.
From the official documentation http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#ignoring-given-when-then-and-but-prefixes :
Prefixes Given, When, Then and And are dropped when matching keywords
are searched
So page does not contain a no template operation selected error message keyword needs to be renamed to But page does not contain a no template operation selected error message.
I am working on my own boilerplate using grunt's CLI possibilities like so grunt init:webdesign-project - for this I created a folder named webdesign-project within node_modules/grunt/init and a corresponding webdesign-project.js file. So far everything works great.
Now I wanted to insert my own "questions" with the grunt.helper function like this
grunt.helper('prompt_for', 'img_path', 'img')
however this gives me
TypeError: Cannot set property 'name' of undefined
at Object.module.exports.grunt.registerHelper.grunt.utils.spawn.cmd (/usr/lib/node_modules/grunt/tasks/init.js:573:17)
at Task.helper (/usr/lib/node_modules/grunt/lib/util/task.js:117:19)
at Object.exports.template (/usr/lib/node_modules/grunt/tasks/init/webdesign-project.js:30:11)
at Object.module.exports.grunt.registerHelper.done (/usr/lib/node_modules/grunt/tasks/init.js:240:27)
at Object.task.registerTask.thisTask.fn (/usr/lib/node_modules/grunt/lib/grunt/task.js:58:16)
at Task.<anonymous> (/usr/lib/node_modules/grunt/lib/util/task.js:341:36)
at Task.start (/usr/lib/node_modules/grunt/lib/util/task.js:357:5)
at Object.grunt.tasks (/usr/lib/node_modules/grunt/lib/grunt.js:143:8)
at Object.module.exports [as cli] (/usr/lib/node_modules/grunt/lib/grunt/cli.js:36:9)
at Object.<anonymous> (/usr/lib/node_modules/grunt/bin/grunt:19:14)
Isn't it possible to define your own variables using this function?
EDIT: Does anybody know if a documentation for this function exists? (Couldn't find one yet)
You shouldn't modify or add files within the node_modules/ folder as they will be overwritten upon updating with npm. Take a look at the init docs for creating custom init templates: https://github.com/gruntjs/grunt/blob/master/docs/task_init.md#creating-custom-templates
I recommend copying one of the existing init templates to: ~/.grunt/tasks/init/webdesign-project.js and modify from there.
I figured out how to achieve the "custom prompt" - in case anybody is interested:
Grunt's grunt.helper('prompt_for', '...') function apparently only takes a predefined set of values in lieu of '...'. Actually this should not be surprising, as there are some pretty unique features for some of those values (e.g. when you've entered testproject as your project's name, "(git://github.com/peter/testproject.git)" will automatically be proposed.
Solution: Take a look at the .js file of the gruntfile template (node_modules/grunt/tasks/init/gruntfile.js) - creating a custom prompt goes like this:
{
name: 'img_path',
message: 'Name the folder where all image files are located',
default: 'img',
// warning: '' couldn't find any use for this optional property
}
instead of
grunt.helper('prompt_for', 'img_path', 'img')
The SQLite.ttinclude (for VB) should have
tbl.Schema="";
in the LoadTables procedure, otherwise the Struts.tt will not compile
Running transformation: System.ArgumentNullException: Value cannot be null.
Parameter name: objectToConvert
at Microsoft.VisualStudio.TextTemplating.ToStringHelper.ToStringWithCulture(Object objectToConvert)
at
Microsoft.VisualStudio.TextTemplatingBB4B38057266A6749A8A039E145DE2BB.GeneratedTextTransformation.TransformText()
I am using the lastest 3.0.0.3 zip from the subsonicproject.com website
Please file this at http://github.com/subsonic/SubSonic-3.0/issues so you can track the status of this bug. If you don't have account (or don't want to create one), just add a comment here and one of us will file it on your behalf.