Azure ARM template keyvault override in Azure DevOps












0















How can I override the ARM template Azure keyvault reference in Azure DevOps? I have ARM template which has reference like:



"KeyVaultSecret": {
"reference": {
"keyVault": {
"id": "/subscriptions/214124-1241-526-645-lele/resourceGroups/KEYVAULT-RG/providers/Microsoft.KeyVault/vaults/KeyVault"
},
"secretName": "VerySecret"
}
}


but I would like to override the id and/or secretName in some cases.










share|improve this question

























  • Use convertfrom-json and convertto-json cmdlets to process the template file...

    – Peter Schneider
    Oct 23 '18 at 10:10











  • My ultimate idea is to override this in the Azure DevOps release pipeline so doing conversions sounds like something that is out of scope.

    – Kamsiinov
    Oct 23 '18 at 10:21











  • Don't forget that you can run custom PowerShell scripts in the Azure DevOps pipelines ;-)!

    – gvee
    Oct 23 '18 at 10:32











  • I can but I like to keep some of the stuff in the ARM templates. Hence the need for overriding parts of the ARM template parameters

    – Kamsiinov
    Oct 23 '18 at 10:32











  • Are you using Azure Devops or are you going to deploy your ARM template manually?

    – Josh
    Oct 23 '18 at 23:58
















0















How can I override the ARM template Azure keyvault reference in Azure DevOps? I have ARM template which has reference like:



"KeyVaultSecret": {
"reference": {
"keyVault": {
"id": "/subscriptions/214124-1241-526-645-lele/resourceGroups/KEYVAULT-RG/providers/Microsoft.KeyVault/vaults/KeyVault"
},
"secretName": "VerySecret"
}
}


but I would like to override the id and/or secretName in some cases.










share|improve this question

























  • Use convertfrom-json and convertto-json cmdlets to process the template file...

    – Peter Schneider
    Oct 23 '18 at 10:10











  • My ultimate idea is to override this in the Azure DevOps release pipeline so doing conversions sounds like something that is out of scope.

    – Kamsiinov
    Oct 23 '18 at 10:21











  • Don't forget that you can run custom PowerShell scripts in the Azure DevOps pipelines ;-)!

    – gvee
    Oct 23 '18 at 10:32











  • I can but I like to keep some of the stuff in the ARM templates. Hence the need for overriding parts of the ARM template parameters

    – Kamsiinov
    Oct 23 '18 at 10:32











  • Are you using Azure Devops or are you going to deploy your ARM template manually?

    – Josh
    Oct 23 '18 at 23:58














0












0








0


1






How can I override the ARM template Azure keyvault reference in Azure DevOps? I have ARM template which has reference like:



"KeyVaultSecret": {
"reference": {
"keyVault": {
"id": "/subscriptions/214124-1241-526-645-lele/resourceGroups/KEYVAULT-RG/providers/Microsoft.KeyVault/vaults/KeyVault"
},
"secretName": "VerySecret"
}
}


but I would like to override the id and/or secretName in some cases.










share|improve this question
















How can I override the ARM template Azure keyvault reference in Azure DevOps? I have ARM template which has reference like:



"KeyVaultSecret": {
"reference": {
"keyVault": {
"id": "/subscriptions/214124-1241-526-645-lele/resourceGroups/KEYVAULT-RG/providers/Microsoft.KeyVault/vaults/KeyVault"
},
"secretName": "VerySecret"
}
}


but I would like to override the id and/or secretName in some cases.







azure powershell azure-devops azure-resource-manager arm-template






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 17 '18 at 14:48







Kamsiinov

















asked Oct 23 '18 at 10:07









KamsiinovKamsiinov

138115




138115













  • Use convertfrom-json and convertto-json cmdlets to process the template file...

    – Peter Schneider
    Oct 23 '18 at 10:10











  • My ultimate idea is to override this in the Azure DevOps release pipeline so doing conversions sounds like something that is out of scope.

    – Kamsiinov
    Oct 23 '18 at 10:21











  • Don't forget that you can run custom PowerShell scripts in the Azure DevOps pipelines ;-)!

    – gvee
    Oct 23 '18 at 10:32











  • I can but I like to keep some of the stuff in the ARM templates. Hence the need for overriding parts of the ARM template parameters

    – Kamsiinov
    Oct 23 '18 at 10:32











  • Are you using Azure Devops or are you going to deploy your ARM template manually?

    – Josh
    Oct 23 '18 at 23:58



















  • Use convertfrom-json and convertto-json cmdlets to process the template file...

    – Peter Schneider
    Oct 23 '18 at 10:10











  • My ultimate idea is to override this in the Azure DevOps release pipeline so doing conversions sounds like something that is out of scope.

    – Kamsiinov
    Oct 23 '18 at 10:21











  • Don't forget that you can run custom PowerShell scripts in the Azure DevOps pipelines ;-)!

    – gvee
    Oct 23 '18 at 10:32











  • I can but I like to keep some of the stuff in the ARM templates. Hence the need for overriding parts of the ARM template parameters

    – Kamsiinov
    Oct 23 '18 at 10:32











  • Are you using Azure Devops or are you going to deploy your ARM template manually?

    – Josh
    Oct 23 '18 at 23:58

















Use convertfrom-json and convertto-json cmdlets to process the template file...

– Peter Schneider
Oct 23 '18 at 10:10





Use convertfrom-json and convertto-json cmdlets to process the template file...

– Peter Schneider
Oct 23 '18 at 10:10













My ultimate idea is to override this in the Azure DevOps release pipeline so doing conversions sounds like something that is out of scope.

– Kamsiinov
Oct 23 '18 at 10:21





My ultimate idea is to override this in the Azure DevOps release pipeline so doing conversions sounds like something that is out of scope.

– Kamsiinov
Oct 23 '18 at 10:21













Don't forget that you can run custom PowerShell scripts in the Azure DevOps pipelines ;-)!

– gvee
Oct 23 '18 at 10:32





Don't forget that you can run custom PowerShell scripts in the Azure DevOps pipelines ;-)!

– gvee
Oct 23 '18 at 10:32













I can but I like to keep some of the stuff in the ARM templates. Hence the need for overriding parts of the ARM template parameters

– Kamsiinov
Oct 23 '18 at 10:32





I can but I like to keep some of the stuff in the ARM templates. Hence the need for overriding parts of the ARM template parameters

– Kamsiinov
Oct 23 '18 at 10:32













Are you using Azure Devops or are you going to deploy your ARM template manually?

– Josh
Oct 23 '18 at 23:58





Are you using Azure Devops or are you going to deploy your ARM template manually?

– Josh
Oct 23 '18 at 23:58












2 Answers
2






active

oldest

votes


















1














You can always use nested templates to do that, just provide a parameter with value, and then use nested template to invoke that. Here's that is using nested templates to get KV values. you can easily replace hardcoded value which I link to with a parameter or with expression, which would allow you to do what you need.



You might go as far as implementing a "switch" like approach to determine needed value based on resource group name.






share|improve this answer
























  • That does not still allow me to give the keyvault id as parameter. Or override it in the Azure DevOps.

    – Kamsiinov
    Nov 17 '18 at 14:46













  • it does, read the answer, if you have any questions - get back to me

    – 4c74356b41
    Nov 17 '18 at 15:49



















0














We use powershell to read in the parameter template as a JSON object $Template then replacing the ID value with the appropriate value and writing out the updated object to a Temp file.



$Template["KeyVaultParm"].reference.keyvault.id = "<NewReferenceID>"


This allows us to use the same template with Prod/Dev and have different KeyVaults while using the same ARM template/parameter files.






share|improve this answer
























  • I would rather use less powershell and more built-in functions.

    – Kamsiinov
    Nov 15 '18 at 9:43











  • Might want to rephrase the question topic...

    – Christopher G. Lewis
    Nov 16 '18 at 19:13











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52946403%2fazure-arm-template-keyvault-override-in-azure-devops%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You can always use nested templates to do that, just provide a parameter with value, and then use nested template to invoke that. Here's that is using nested templates to get KV values. you can easily replace hardcoded value which I link to with a parameter or with expression, which would allow you to do what you need.



You might go as far as implementing a "switch" like approach to determine needed value based on resource group name.






share|improve this answer
























  • That does not still allow me to give the keyvault id as parameter. Or override it in the Azure DevOps.

    – Kamsiinov
    Nov 17 '18 at 14:46













  • it does, read the answer, if you have any questions - get back to me

    – 4c74356b41
    Nov 17 '18 at 15:49
















1














You can always use nested templates to do that, just provide a parameter with value, and then use nested template to invoke that. Here's that is using nested templates to get KV values. you can easily replace hardcoded value which I link to with a parameter or with expression, which would allow you to do what you need.



You might go as far as implementing a "switch" like approach to determine needed value based on resource group name.






share|improve this answer
























  • That does not still allow me to give the keyvault id as parameter. Or override it in the Azure DevOps.

    – Kamsiinov
    Nov 17 '18 at 14:46













  • it does, read the answer, if you have any questions - get back to me

    – 4c74356b41
    Nov 17 '18 at 15:49














1












1








1







You can always use nested templates to do that, just provide a parameter with value, and then use nested template to invoke that. Here's that is using nested templates to get KV values. you can easily replace hardcoded value which I link to with a parameter or with expression, which would allow you to do what you need.



You might go as far as implementing a "switch" like approach to determine needed value based on resource group name.






share|improve this answer













You can always use nested templates to do that, just provide a parameter with value, and then use nested template to invoke that. Here's that is using nested templates to get KV values. you can easily replace hardcoded value which I link to with a parameter or with expression, which would allow you to do what you need.



You might go as far as implementing a "switch" like approach to determine needed value based on resource group name.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 13:22









4c74356b414c74356b41

25.8k42052




25.8k42052













  • That does not still allow me to give the keyvault id as parameter. Or override it in the Azure DevOps.

    – Kamsiinov
    Nov 17 '18 at 14:46













  • it does, read the answer, if you have any questions - get back to me

    – 4c74356b41
    Nov 17 '18 at 15:49



















  • That does not still allow me to give the keyvault id as parameter. Or override it in the Azure DevOps.

    – Kamsiinov
    Nov 17 '18 at 14:46













  • it does, read the answer, if you have any questions - get back to me

    – 4c74356b41
    Nov 17 '18 at 15:49

















That does not still allow me to give the keyvault id as parameter. Or override it in the Azure DevOps.

– Kamsiinov
Nov 17 '18 at 14:46







That does not still allow me to give the keyvault id as parameter. Or override it in the Azure DevOps.

– Kamsiinov
Nov 17 '18 at 14:46















it does, read the answer, if you have any questions - get back to me

– 4c74356b41
Nov 17 '18 at 15:49





it does, read the answer, if you have any questions - get back to me

– 4c74356b41
Nov 17 '18 at 15:49













0














We use powershell to read in the parameter template as a JSON object $Template then replacing the ID value with the appropriate value and writing out the updated object to a Temp file.



$Template["KeyVaultParm"].reference.keyvault.id = "<NewReferenceID>"


This allows us to use the same template with Prod/Dev and have different KeyVaults while using the same ARM template/parameter files.






share|improve this answer
























  • I would rather use less powershell and more built-in functions.

    – Kamsiinov
    Nov 15 '18 at 9:43











  • Might want to rephrase the question topic...

    – Christopher G. Lewis
    Nov 16 '18 at 19:13
















0














We use powershell to read in the parameter template as a JSON object $Template then replacing the ID value with the appropriate value and writing out the updated object to a Temp file.



$Template["KeyVaultParm"].reference.keyvault.id = "<NewReferenceID>"


This allows us to use the same template with Prod/Dev and have different KeyVaults while using the same ARM template/parameter files.






share|improve this answer
























  • I would rather use less powershell and more built-in functions.

    – Kamsiinov
    Nov 15 '18 at 9:43











  • Might want to rephrase the question topic...

    – Christopher G. Lewis
    Nov 16 '18 at 19:13














0












0








0







We use powershell to read in the parameter template as a JSON object $Template then replacing the ID value with the appropriate value and writing out the updated object to a Temp file.



$Template["KeyVaultParm"].reference.keyvault.id = "<NewReferenceID>"


This allows us to use the same template with Prod/Dev and have different KeyVaults while using the same ARM template/parameter files.






share|improve this answer













We use powershell to read in the parameter template as a JSON object $Template then replacing the ID value with the appropriate value and writing out the updated object to a Temp file.



$Template["KeyVaultParm"].reference.keyvault.id = "<NewReferenceID>"


This allows us to use the same template with Prod/Dev and have different KeyVaults while using the same ARM template/parameter files.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 '18 at 4:30









Christopher G. LewisChristopher G. Lewis

4,3502139




4,3502139













  • I would rather use less powershell and more built-in functions.

    – Kamsiinov
    Nov 15 '18 at 9:43











  • Might want to rephrase the question topic...

    – Christopher G. Lewis
    Nov 16 '18 at 19:13



















  • I would rather use less powershell and more built-in functions.

    – Kamsiinov
    Nov 15 '18 at 9:43











  • Might want to rephrase the question topic...

    – Christopher G. Lewis
    Nov 16 '18 at 19:13

















I would rather use less powershell and more built-in functions.

– Kamsiinov
Nov 15 '18 at 9:43





I would rather use less powershell and more built-in functions.

– Kamsiinov
Nov 15 '18 at 9:43













Might want to rephrase the question topic...

– Christopher G. Lewis
Nov 16 '18 at 19:13





Might want to rephrase the question topic...

– Christopher G. Lewis
Nov 16 '18 at 19:13


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52946403%2fazure-arm-template-keyvault-override-in-azure-devops%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to pass form data using jquery Ajax to insert data in database?

National Museum of Racing and Hall of Fame

Guess what letter conforming each word