-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding how to use deployment output info to README #11148
Conversation
@@ -73,6 +73,28 @@ The following parameters are shown when the selected action is to create or upda | |||
|
|||
* **Deployment Mode**: This specifies the [deployment mode](https://azure.microsoft.com/en-us/documentation/articles/resource-group-template-deploy) in which the Azure resources specified in the template have to be deployed. Incremental mode handles deployments as incremental updates to the resource group . It leaves unchanged resources that exist in the resource group but are not specified in the template. Complete mode deletes resources that are not in your template. [Validate mode](https://msdn.microsoft.com/en-us/library/azure/dn790547.aspx) enables you to find syntactical problems with the template before creating actual resources. By default, incremental mode is used. | |||
|
|||
### Deployment Outputs: | |||
It is the output of the deployment object created using Azure Resource Manager templates which can be used in the subsequent tasks like Powershell and Azure CLI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-word to "Outputs created by Azure Resource Manager template deployment. It can be used in subsequent tasks (like Azure Powershell or Azure CLI) for further processing."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
``` | ||
$var=ConvertFrom-Json '$(storageAccountName)' | ||
$value=$var.storageAccountName.value | ||
Write-Host "##vso[task.setvariable variable=value;]$value" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write-Host "##vso[task.setvariable variable=storageAccount;]$value"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
Example: | ||
``` | ||
var=`echo "$(storageAccountName)" | sed -e 's/}/"\n}/g' | sed -e 's/{/{\n"/g' | sed -e 's/:/":"/g' | sed -e 's/,/",\n"/g' | sed -e 's/"}/}/g' | sed -e 's/}"/}/g' | sed -e 's/"{/{/g' | sed -e 's/\[/\[\n"/g' | sed -e 's/]/"\n]/g' | sed -e 's/"\[/\[/g' | sed -e 's/]"/]/g'` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
It is the output of the deployment object created using Azure Resource Manager templates which can be used in the subsequent tasks like Powershell and Azure CLI. | ||
|
||
**How to use Deployment output** | ||
The deployment output can be parsed to JSON object using "ConvertFrom-Json" PowerShell cmdlet in Poweshell task and then that object can be used in other tasks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deployment output can be parsed to JSON object using "ConvertFrom-Json" PowerShell cmdlet in Poweshell task and then that object can be used in other tasks. | |
The deployment output can be parsed to JSON object using "ConvertFrom-Json" PowerShell cmdlet in Powershell/Azure Poweshell task and then that object can be used in same task or subsequent tasks. |
Write-Host "##vso[task.setvariable variable=value;]$value" | ||
``` | ||
|
||
On linux agent if you want to use deployment output in Azure CLI task, you can avoid extra Powershell task by adding double quotes to convert it to valid JSON. This is needed because Azure CLI task on linux uses bash and the bash removes the double quotes of JSON string making it invalid JSON. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On linux agent if you want to use deployment output in Azure CLI task, you can avoid extra Powershell task by adding double quotes to convert it to valid JSON. This is needed because Azure CLI task on linux uses bash and the bash removes the double quotes of JSON string making it invalid JSON. | |
On linux based agents, same technique of Powershell task can be used to create a JSON variable. However, if you want to avoid Powershell task, you can use a script similar to below which converts the Outputs to valid JSON by adding double quotes. |
@@ -73,6 +73,39 @@ The following parameters are shown when the selected action is to create or upda | |||
|
|||
* **Deployment Mode**: This specifies the [deployment mode](https://azure.microsoft.com/en-us/documentation/articles/resource-group-template-deploy) in which the Azure resources specified in the template have to be deployed. Incremental mode handles deployments as incremental updates to the resource group . It leaves unchanged resources that exist in the resource group but are not specified in the template. Complete mode deletes resources that are not in your template. [Validate mode](https://msdn.microsoft.com/en-us/library/azure/dn790547.aspx) enables you to find syntactical problems with the template before creating actual resources. By default, incremental mode is used. | |||
|
|||
### Deployment Outputs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a link to this section in task.json input helptext
No description provided.