How to deploy PKI in Azure using JSON template (windows server) - json

I'm new to Azure.
I have JSON template that successfully deploys VM.
Can I add some code to JSON template to deploy this VM with rootCA. Or some syntax for AD CS deployment.
I googled a lot but there are only DSC methods.

You can't "add some code to JSON template".
Your options:
Native ARM via Keyvault:
https://github.com/Azure/azure-quickstart-templates/blob/875d139c16c9c023dce519e6dd48c707e3473346/201-vm-push-certificate-windows/azuredeploy.json
Add an extention to the ARM template.
An extention can be DSC as you mentioned, but can also be custom PowerShell for example. (see custom script extension)
Run your script after the deployment. If you run New-AzureRmResourceGroupDeployment form PowerShell, you can output the VM connection information, and manage it after. See how to configure WinRM on a created VM.

Related

Error `Unable to find a template property named $schema.` when trying to decompile JSON into Bicep

I'm playing with Azure Bicep and I was expecting that I can take practically any ARM JSON template and translate it into Bicep. I'm intentionally using the word "translate" instead of "decompile" here, because the JSON template was not originally created with Bicep, so it was not compiled from Bicep to JSON in the first place.
I'm creating a VM deployment in the Azure Portal and when it's successfully deployed I download the JSON template (deployment.json and deployment_operations.json).
Then I run the following command:
bicep decompile deployment.json
The command fails with the following error message:
/deployment.json: Decompilation failed with fatal error "[1:1]: Unable to find a template property named $schema."
What should I do to resolve this error?
Bicep CLI version 0.13.1 (e3ac80d678).
PS The VM deployment is the simplest possible Windows Server VM with no data disks and extra features. Created via Azure Portal by clicking Next-Next-Create.
It appears that I've found the solution when writing the question. I was downloading and trying to decompile a wrong file.
The problem was that I was downloading the deployment.json file instead of an actual template file template.json. You need to click Download on the Template tab.
So instead of downloading the from the Overview tab, click the Template tab and then click Download. Or use the Save-AzResourceGroupDeploymentTemplate PowerShell cmdlet.
Similar problem, same solution: https://github.com/Azure/bicep/issues/5237

##[error]Error: NO JSON file matched with specific pattern: **/appsettings.json

I'm trying to deploy an Azure App Service using Azure Devops.
I'm using the Task Azure App Service deploy version 4.*
I started noticing the following error in the log recently with the deployment failing (saw it first on 24th September)
Applying JSON variable substitution for **/appsettings.json
##[error]Error: NO JSON file matched with specific pattern: **/appsettings.json.
In the pipeline I use the task Extract files to extract *.zip, then use the result to search for **/appsettings.json.
The same task was running fine till a few days ago.
I tried redeploying an old release which was successful earlier, but it failed now with the same above error.
I double checked, there was no changes done in the pipeline recently for this to break.
How can I fix this.
Turns out my issue was not with the task Azure App Service deploy, but with the task Extract Files.
A rough look on my pipeline is as below:
Before the fix
Extract files
Deploy Azure App Service
The JSON variable substitution failed because the Extract files task was not able to find *.zip files in the root folder and hence extracted nothing. So, there was no appsettings.json file in the folder structure at all.
The Fix
Update the Extract files task search pattern as **/*.zip
Now my pipeline looks like below.
Extract files
Deploy Azure App Service
It now works fine for me.

JSON file to create release pipeline and add Agent Job and tasks to deploy Web App on Azure App Service Deploy

How can I code a JSON file to create release pipeline to create Agent job with following tasks
1) Download Build Artifacts task
2) Azure App Service Deploy task
3) File Transform Task
4) Azure SQL SqlTask
1) You can create one release with such configuration via UI, then export it. It will generate and install a file with JSON code to your local. Then you could check its scripts by yourself:
2) Or change to History tab after you create the release via UI. In History, you can also view its JSON code.
The configuration structure you want is not suitable to share here directly. So I'd recommend you the above steps to configure JSON file by yourself.
If above does not satisfied or not convenient to you, I may consider to share full JSON code here to you:-)

WS02: error No artifacts found to be deployed in this server. Ignoring Carbon Application

Following process outlined here to create a axis service from a pojo:
Webinar: Building Applications with Carbon Studio for On-Premise and the Cloud.
I create the axis services as described in the webinar.
I did a mvn package sucessfully.
I start the WS02 ESB in eclipse sucessfully.
But when I deploy my app to the WS02 ESB, I see the following in the console:
INFO - ApplicationManager Deploying Carbon Application : MyCarbonApp-1.0.0.car...
WARN - ApplicationManager No artifacts found to be deployed in this server. Ignoring
Carbon Application : MyCarbonApp-1.0.0.car
and the service does not appear on the ESB console's web services list.
When I look at the file called MyAxisService.service I see the following:
#Contains the information about the axis2 service generation information from the eclipse workspace
#Fri May 25 15:53:09 NZST 2012
Class-name=com.unisys.comms.esbselection.MyAxisService
Type=FROM_CLASS
Service-name=MyAxisService
Projects=MyCarbonApp
What does this warning mean?
What can I do to further investigate the cause?
Is there some obvious step I've missed when creating the app?
Thanks in advance.
Please follow these steps to solve this issue.
Go to carbon.xml file locate in ....\wso2esb-4.9.0\repository\conf
Add new server role to xml elemet
EnterpriseServiceBus
ApplicationServer
Restart the server
This error means the Server Roles of the C-App Artifacts found in your Carbon Application Archive (CAR), does not match the Server Role of the ESB.
Reason is, Axis2 Web Services are by default has the Server Role of "ApplicationServer". Hence if you deploy it on the WSO2 AS, it will deploy without any problem. But in this case, you have tried to Deploy it the WSO2 ESB. Since the WSO2 ESB has the Server Role "EnterpriseServiceBus" and your Axis2 web service has the Server Role "ApplicationServer", they do not match each other. Result is the C-App deployer will ignore the C-App.
To solve this, you need to change the Server Role of your Axis2 Web Service. In order to do that, follow the steps below.
Go the C-App project you created and browse to the Axis2 Service Artifact folder in the "Artifacts" folder of the C-App.
Inside this Axis2 Service Project, you will see a file called "Artifact.xml". Open this file by double clicking on the file.
Once you double click on the file, file will be opened in the Artifact editor. Scroll the Editor down a bit.
There you will see a Drop Down next to a Label called "Server Role".
Select "EnterpriseServiceBus" option from the Drop down list and click on "Save All" button on the Eclipse Tool bar.
Go to the Servers view in Carbon Studio and click on the expand icon infront of the Carbon Server (WSO2 ESB in this case)
Once you expand the Server, you will be able to see the Server Module (C-App project) you deployed in the ESB.
Right Click on the C-App module under the ESB Server and Select "Redeploy".
Now you will see that Carbon Studio redeploy the C-App project and if you followed all the steps above correctly, your Axis2 Web Service will be deployed in the ESB.
Hope this helps!!
Thanks.
/Harshana

How to create Elastic beanstalk configuration template for a Environment

Whenever i create a new Environment in Elastic Beanstalk, i manually configure the Custom AMI ID, SNS notifications etc., but i want to do it automatically i.e, save the settings(custom AMI ID, SNS, key-pair etc.,) into a configuration template. Is it through Command line tools or from AWS management console that we can create this Configuration Template. Please suggest me.
You can easily do this through Amazon's web console. If you have a configuration you like just press save configuration. You can then use edit/load configuration to push that to new environments
If you are using the elastic beanstalk command line tools, when you setup an environment using the command git aws.config it creates a directory called .elasticbeanstalk with a file in it called config that looks like this:
[global]
AwsCredentialFile=/path/to/file/with/aws/account/credentials
ApplicationName=YourAppName
DevToolsEndpoint=git.elasticbeanstalk.your-region-name.amazonaws.com
EnvironmentName=yourEnvName
Region=your-region-name
Hope that helps!
Elastic Beanstalk's console is pretty lacking when it comes to configuring templates. You can't update or delete templates. There is a command line tool for full control.
You can also get the AWS Eclipse plugin. It's not as full featured like the CLI, but much better than web console.