Azure shared image gallery versions using terraform - azure

Can you please help me how to list all the image versions available in Azure Shared Image gallery. I tried all the below , but no luck
https://www.terraform.io/docs/providers/azurerm/d/shared_image_gallery.html
https://www.terraform.io/docs/providers/azurerm/d/shared_image_version.html
https://www.terraform.io/docs/providers/azurerm/d/shared_image.html

There doesn't appear to be a way to do this with the default Terraform data resources. Here is a GitHub repo that leverages a null resource to allow you to run commands that can return data. With something like that you could leverage the Azure CLI to return all your images. Here is the command for the Azure CLI.
Hope this helps.

Related

How to call image inspect properties in hosted in ACR

I have few images hosted in ACR, I want to inspect the image (Repository image) deployed in ACR.
For example I have one "hello-world" image in "test123" ACR. I want to inspect ACR image and read the json content of the image. I didn't see any suitable .NET packages or .NET SDK libraries.
how to run "docker image inspect test123.azurecr.io/hello-world:v3" using .NET SDK libraries by connecting AZURE Container Registry (ACR) ?
I have tried following packages, but I didn't see any support to get similar command using .NET Libraries.
https://www.nuget.org/packages/Microsoft.Azure.Management.ContainerService/
https://www.nuget.org/packages/Docker.DotNet/
https://github.com/dotnet/dotnet-docker
You can use the azure cli (az). It has a manifest command.
az acr manifest show --registry my-acr --name hello-world:123
Finally I got answer for my question. We can use Http V2 API capabilities to retrieve Manifest or Config information to retrieve.
To get manifest information below is the URL's
GET {url}/v2/{name}/manifests/{reference}
https://test.azurecr.io/v2/{imageName}/manifests/Sha:25635dfger4656454fggf
GET {url}/v2/{name}/blobs/{digest}
https://test.azurecr.io/v2/{imageName}/blobs/Sha:4534afdf33289988956565
Note: There are different digest's available for image. You will see one digest for entire Manifest and different digest for Config of Manifest section.
Please find below documentation
https://learn.microsoft.com/en-us/rest/api/containerregistry/manifests/get
https://learn.microsoft.com/en-us/rest/api/containerregistry/blob/get

Create Azure Devops environment from script

I would like to create an Azure DevOps Pipeline Environment from Powershell.
Using Azure CLI or the Azure REST API however, I can not find any information on this.
There are some notions about the environments in the release but that's not what I need.
When using the portal following URL is called "/_apis/distributedtask/environments" but can't find any information about this REST API endpoint.
Does anyone know how to automate this?
You're right, If I check the network section when I create a new environment I can see it uses this api:
https://dev.azure.com/{org}/{project}/_apis/distributedtask/environments
With this JSON body:
{
"description":"",
"name":"test"
}
I don't see it domunetd but it should work :)

Set command doesn't work for the deployment update in Azure Kubernetes cluster

I'm using Azure DevOps pipelines to update our deployment in K8s cluster in Azure. It used to be working fine until yesterday, as for some reason the Pods in the cluster remain in their previous state. I can see that the image was successfully updated in ACR (container registry) and has a label 'latest'. However, the release pipeline doesn't seem to be doing anything useful. I use 'set' command in the task to update the Pod (it is well described in the Kubernetes docs and cheatsheet here)
This is the command sample extracted from the log:
kubectl set image deployments/identityserver identityserver='myacr'/identityserver:latest -n identityserver-dev
As it indicates, I'm getting the latest image from ACR and trying to roll an update. It executes well (both in cmd and Azure DevOps). no errors, although, the Pod remains unaffected. Have I missed something in the docs? Should I raise the ticket with Microsoft?
why do you have ' in image name? also, latest wont work if you already have latest on the image, you need to be specific https://github.com/kubernetes/kubernetes/issues/33664.
This is not an Azure issue
Please check here answers to similar question on SO, on why it is not a good option to use :latest tag in your Deployment spec, along with workarounds provided.

Docker task : How to set the Azure container registry name or id from build/release variable?

I have a problem on my build/release pipeline with Azure Container Reigstry.
I use a Azure Resource Group Deployment task to deploy Azure Container Registry (and other stuff) and it works perfectly.
I have the loginServer, username and password in output variables to reuse it.
Then I want to build and push image to ACR but I can't set the name of the registry (that I get from output variable) with a variable. I have to choose the registry when I setup the definition, but it is not created at this moment.
Is there a way to do this ?
As a workaround, I use the Azure Resource Group Deployment the create the registry and then I send output variables to a powershell script which build, tag and push my images to the registry.
If nobody has a better way, I think I will post a uservoice to change that.
When you say you use an Azure Resource Group Deployment task, are you referring to VSTS?
If you could provide more specific repro steps, I might be more helpful.
I'd also suggest you might take a look at https://aka.ms/acr/build as easy way to natively docker build images with your registry. ACR Build is now available in all regions and simplifies may of the experiences you may be hitting.
Daniel just made this post that helps with the VSTS integration: https://www.danielstechblog.io/building-arm-based-container-images-with-vsts-and-azure-container-registry-build/
Steve
Sorry for the delay, I was off the office.
I just retry to fix my problem and it seems that I can now enter a free text (and so, a release variable) to the VSTS docker task to specify the ACR I just created before with a Azure Resource Group Deployment task.
So no problem anymore.
Thank you for your response, I will take a look to ACR build :)
Bastien

Specifying Kubernetes version for Azure Container Service

Does anyone know if it is possible to specify the Kubernetes version when deploying ACS Kubernetes flavour?
If so how?
Using the supported resource provider in ARM you cannot specify the version. However, if you use http://github.com/Azure/acs-engine you can do so. ACS Engine is the open source code we (I work for MS) use to drive Azure Container Service. Using this code you have much more flexibility than you do through the published resource provider, but it's a harder onramp. For instructions see https://github.com/Azure/acs-engine/blob/master/docs/kubernetes.md
See examples at https://github.com/Azure/acs-engine/tree/master/examples/kubernetes-releases
You should use acs-engine and follow the deploy guide in the repo (https://github.com/Azure/acs-engine/blob/master/docs/kubernetes/deploy.md).
In the deploy guide they use the file examples/kubernetes.json and in that file there's -
"orchestratorProfile": {
"orchestratorType": "Kubernetes"
}
You can also add the field "orchestratorRelease": "1.7" for Kubernetes 1.7.
To view the whole list of releases available you can use the acs-engine executable and run acs-engine orchestrators that prints all of them.
Other examples can be found in https://github.com/Azure/acs-engine/tree/master/examples/kubernetes-releases

Resources