Azure CLI command to deploy the Azure logic app local ARM template - azure-logic-apps

I have downloaded the logic app template from one resource group , I have modified the template and that modified template I want to deploy it into the another resource group which I already created resource group along with storage account as well.
Can you please help me out with the Azure CLI command to deploy the local Arm template (Logic app).

you are looking for az group deployment create, example:
az group deployment create -g MyResourceGroup --template-file azuredeploy.json \
--parameters #params.json --parameters https://mysite/params.json --parameters MyValue=This MyArray=#array.json
https://learn.microsoft.com/en-us/cli/azure/group/deployment?view=azure-cli-latest

Related

Deploy ReactJs Azure Static Web App based on Azure DevOps git repo via Azure CLI

I'm actually working on the Continuous Delivery pipeline for the UI project made in ReactJs with the use of the Azure Static Web App.
I want to create and deploy the static web app to Azure based on the git repo located in Azure DevOps.
The reason behind this is I see a huge opportunity to create a Pull Request Environment pipeline for the system I work on every day with the usage of static web apps which seem to be a super cheap and fast solution! Then the pipeline would allow testing the Pull Request changes in isolation before releasing to DEV, QA,... Prod environments.
Anyway, straight to the point.
The official Microsoft documentation provides only an example of how to do this for GitHub repo but I cannot find any info on how this can be achieved when using Azure DevOps git repo:
az staticwebapp create \
-n my-first-static-web-app \
-g <RESOURCE_GROUP_NAME> \
-s https://github.com/<YOUR_GITHUB_ACCOUNT_NAME>/my-first-static-web-app \
-l <LOCATION> \
-b main \
--app-artifact-location "build" \
--token <YOUR_GITHUB_PERSONAL_ACCESS_TOKEN>
I thought that the way the az staticwebapp create works in the provided example should be analogical with the Azure DevOps.
I thought that equivalent of YOUR_GITHUB_PERSONAL_ACCESS_TOKEN in Azure DevOps would be an access token that can be generated:
When I try to run the following code:
az staticwebapp create -l westus2 -n appNameTest1 -g TestPrEnvResourceGroup -s "https://dev.azure.com/myOrganisationName/myProjectName/_git/myRepoName -b "main" --token "generatedTokenValuefwfsdgsgsd"
I'm getting the following exception;
Command group 'staticwebapp' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus Operation returned an invalid status 'Bad Request'
Also, I don't think it can matter but the TestPrEnvResourceGroup is created under the UK West location.
It doesn't tell me much, like if the token or some other parameter is wrong...
Any ideas?
Cheers
Have you tried this way?
You need to generate a deployment token from the Azure Static Web App and have it in the YAML
I tried the same for Angular app and it worked pretty well
azure_static_web_apps_api_token: $(deployment_token)
UPDATE : As per the Github issue , currently this is not supported.
We currently don’t support automatically creating Azure DevOps
pipelines. This is the supported path for using Azure DevOps:
https://learn.microsoft.com/en-us/azure/static-web-apps/publish-devops
You can vote for the feature here

kubectl command cannot find namespace value

I am trying to deploy an application vis Google Cloud with K8. I ran kubectl create -f app.yaml and everything seemed to work fine. I can go to my Project profile and view the "app" cluster in the "Kubernetes clusters" page. However, when I try to view my pods and their info via the terminal I run into this strange situation:
% kubectl get pods -n app
No resources found in app namespace.
% kubectl create -f app.yaml
Error from server (AlreadyExists): error when creating "app.yaml": services "app" already exists
% kubectl -n app rollout restart deployment project
Error from server (NotFound): namespaces "app" not found
kubectl cannot find the name "app" but I cannot recreate "app" because the name already exists!
My end goal is to view the pods info and get the External IP value.
My end goal is to view the pods info and get the External IP value:
To get info about pods, try kubecl get pods --all-namespaces -o wide
Right now there are just no pods in namespace app according to this error "No resources found in app namespace." Running the above will give you more info.
kubectl get svc -o wide
should provide you with the external IP you are looking for.

google cloud app engine deploy failed

I following the google cloud console right side tutorial to deploy a ruby project, after clone the demo source code the try to using command gcloud app deploy --project fireflywytwyt to deploy, it throw following error to me(Unnecessary logs is omitted):
...
8820c09c846d: Image already exists
64fc2a97cff9: Image already exists
43f58141118b: Image already exists
575d6bde5efe: Image already exists
272ffca85019: Image already exists
90a62e26e551: Image already exists
a51047f764d0: Image already exists
2c8496abe349: Image already exists
6e04b82f3d6e: Image already exists
latest: digest: sha256:406115ccfa93d7cef120b2683f75c9f5b3821d8a11b8afbca7781240c293313e size: 72372
DONE
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [7] The user fireflywytwyt#appspot.gserviceaccount.com must have permission to read the image at us.gcr.io/fireflywytwyt/appengine/def
ault.20161124t144728:latest
Please notice the error:
The user fireflywytwyt#appspot.gserviceaccount.com must have permission to read the image at us.gcr.io/fireflywytwyt/appengine/def
It seems my account cannot access the docker registry, how to fix that?
You need to give the service user (in your case fireflywytwyt#appspot.gserviceaccount.com ) Editor role. To do this
Open the IAM & Admin page in the Cloud Platform Console.
Select your project and click Continue.
Click Add member.
Enter the email address of the service account, select an Editor role and click Add.
Give your Service Account appropriate permissions:
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
--member serviceAccount:codelab#${PROJECT_ID}.iam.gserviceaccount.com \
--role roles/owner

mvn appengine:update from Bamboo requires credentials

I have a maven project that updates appspot with my war, but when the build is executed by Atlassian Cloud Bamboo the OAuth authentication prompts for access tokens.
14-May-2015 00:17:18 [INFO] Retrieving Google App Engine Java SDK from Maven
14-May-2015 00:17:18 [INFO] Updating Google App Engine Application
14-May-2015 00:17:18 [INFO] Running -V 1.9.20 --oauth2 update /mnt/bamboo-ebs/bamboo-agent/build-dir/[project path]-1-SNAPSHOT
14-May-2015 00:17:21 Please open the following URL in your browser:
14-May-2015 00:17:21 https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&client_id=XXXXXXXX.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/appengine.admin%20https://www.googleapis.com/auth/cloud-platform
Opening the url I'm able to get an access token, but I'm not able to enter it so the build hangs until cancelled.
How should I setup authentication?
Add the oath credentials to an EBS attached volume and copy them into place when the Agent is started.
Configure bamboo for EBS attached volumes
SSH into the instance, su to bamboo user
Download the Appengine SDK
Run appcfg to be prompted for authentication
appcfg -s my-app.appspot.com version
follow instructions for oauth which will create /home/bamboo/.appcfg_oauth2_tokens_java
mkdir /mnt/bamboo-ebs/appengine
cp /home/bamboo/.appcfg_oauth2_tokens_java /mnt/bamboo-ebs/appengine
edit /mnt/bamboo-ebs/bin/customize-extras.sh (see docs) adding the following
cp /mnt/bamboo-ebs/appengine/.appcfg_oauth2_tokens_java /home/bamboo/
chown bamboo:bamboo /home/bamboo/.appcfg_oauth2_tokens_java
Take a snapshot of the volume and assign the snapshot to your bamboo instance configuration
The next time bamboo starts a new instance the customize-extras.sh will be run and the necessary credentials will be in place for mvn appengine:update to find.

How do I download the source code of a google app engine project?

This seems like it should be very easy but I don't see a link to it anywhere.
How do I download the source code of a google app engine project?
Windows
appengine-java-sdk\bin\appcfg.cmd -A <your_app_id> -V <your_app_version> download_app <output-dir>
Linux
./appengine-java-sdk/bin/appcfg.sh -A <your_app_id> -V <your_app_version> download_app <output-dir>
For completeness, using the Python implementation:
appcfg.py download_app -A $appID -V $appVersionNumber $downloadDirectory --oauth2
--oauth2 is of course optional, you can omit it and provide your email + app-specific password (or your password, and then go implement two-factor authentication right after), but it's easier, and frankly there's no reason not to.
Documentation.
App Engine actually recently added the ability for the developer who uploaded a given app version to download its source code.
As of October 2019 you can simply go to --> App Engine --> Services and in the tool dropdown select 'source' and the source code is there
Posting this since none of the listed methods above didn't take me to the code (by June 2021)
You could try accessing it through;
Google Cloud Platform > Debugger > choosing the version of the
Application from combo at top.
This will list the files of that version on the left pane. There is no way to download it automatically but you can copy-paste the code.
Hope you will find this helpful.
IMHO, the best option today (Aug 2018) is:
Under the main menu, under Products, go to Tools -> Cloud Build -> Build history.
There, click the ID of the build you want (for me - the last one).
Then, in the opened window (Build details), click the "source" link, the download of your compressed code begins.
As simple as that.
HTH.
Working with App engine standard using Go, the debugger isn't available yet.
How I managed to download the source code for an existing service was to use the gcloud tool.
First: Get the version id of your service using the app engine console or running: gcloud app versions list
Second: use the version and service name and run: gcloud app versions describe <versionID> --service=<service name>
the describe parameter will give you the storage locations for your source files that looks like this:
cmd/main.go:
sha1Sum: e3fe5848c2640eca7ac3591490e1debc2d3a9b09
sourceUrl: https://storage.googleapis.com/<project>/<file id>
Third: you can then use the storage console, using the file id, to download the files you are interested in.
this process based on java sdk
Its works for me...
Download Google cloud SDK
gcloud init
enter image description here
Follow through process of logging in using your credentials
Enter following command from SDK
C:\Program Files (x86)\Google\appengine-java-sdk-1.9.49\bin
enter image description here
Enter Following command to download source code
appcfg.sh -A [YOUR_APP_ID] -V [YOUR_APP_VERSION] download_app [OUTPUT_DIR]
Eg: appcfg.sh -A my-project-name-1234 -V 2 download_app C:\Users\india\Desktop\my project
Note: this progress based on java-appengine sdk so we use appcfg.sh instead of appcfg.py
check if your app is uploaded with same email id that is in your app engine. if you are not sure then in app engine > control > Clear deployment credentials and then click on any project, deploy to sign in again then use this
appcfg.py download_app -A {app id from google app engine} -V {1} "{c:\path}" --oauth2_credential_file=C:\Users\{your account name}/.appcfg_oauth2_tokens
change all {} to your needs
Things have changed since this question was asked so I'm adding an updated answer. Note that this only applies to GAE Standard Environment
Google has deprecated appcfg.py and so the previous responses appcfg.py download_app no longer works.
gcloud which is the SDK in use (it replaced appcfg) does not have the functionality to download your source code.
When you deploy your app via gcloud app deploy, it copies your source code to a bucket. The default bucket is staging.<project_name>.appspot.com. Your files will stay in this bucket for a maximum of 15 days before they are deleted. You can modify the rule so that the files are retained for longer or less time.
The file names in the bucket are encoded so you can't figure out what each file is unless you open it (i.e. download it). Google has a mapping of the encoded names to the original file names. To get this mapping, you run the gcloud app versions describe command and it will list the file names and their encoded names. To download the files, you have to manually click each url one by one. So essentially, you have to download each file manually and then use the mapping to rename them (or open the file, check the content and then rename them). Also note that downloading the files manually will not maintain the folder structure in which they were uploaded.
If you do not wish to go through all of the above hassles (imagine having to manually open each url for each file if you have a small to mid-sized project which has hundreds of files), our App - https://nocommandline.com - now supports downloading source code from the default bucket - staging.<project_name>.appspot.com (so far as your files are still there which means any deployment i.e update not older than 15 days from your current date unless you previously increased the deletion age on your staging bucket's lifecycle page).
In simple terms, you enter your project name, the version number and our App will take care of retrieving the original file name to encoded name mapping, automatically downloading the files and renaming them to the original names, while maintaining the folder structure. For more information, refer to https://nocommandline.com/help/#faq_download_source_code_from_gae.
Log in to the console.developers.google.com
Select the project you want to download the code from (Google App Engine Standard Envoronment).
Go to the App Engine Dashboard. Under Summary is Debug and Source. Click on Source.
Select each file one at a time and copy it (highlight the code, copy and paste into your local editor.)
Select the next file....
You need to use svn to checkout the files.
If you are on Windows, you can use tortoise svn for your GUI end.
Here are tutorials on how to do it, here is the related question.

Resources