Skip to content
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

Please provide the JSON examples for --service-endpoint-configuration #1495

Closed
ngnmhieu opened this issue Apr 2, 2020 — with docs.microsoft.com · 9 comments
Closed
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. DevOps issue-addressed This issue is addressed and ready to close. Service Attention This issue is responsible by Azure service team.

Comments

Copy link

ngnmhieu commented Apr 2, 2020

I've had hard time figuring out how to create a service connection to ACR Container Registry with Azure Devops CLI. Please provide an example for that. The JSON that that I've used for --service-endpoint-configuration is:

{
  "administratorsGroup": null,
  "authorization": {
    "parameters": {
      "loginServer": "$ACR_REGISTRY_NAME.azurecr.io",
      "role": "8311e382-0749-4cb8-b61a-304f252e45ec", 
      "scope": "$ACR_REGISTRY_ID",
      "servicePrincipalId": "",
      "tenantId": "$TENANT_ID"
    },
    "scheme": "ServicePrincipal"
  },
  "data": {
    "appObjectId": "",
    "azureSpnPermissions": "",
    "azureSpnRoleAssignmentId": "",
    "registryId": "$ACR_REGISTRY_ID",
    "registrytype": "ACR",
    "spnObjectId": "",
    "subscriptionId": "$SUBSCRIPTION_ID",
    "subscriptionName": "$SUBSCRIPTION"
  },
  "description": "ACR Service Connection created by automated infrastructure pipeline.",
  "groupScopeId": null,
  "isReady": true,
  "isShared": false,
  "name": "$SERVICE_CONNECTION_NAME",
  "operationStatus": {
    "state": "Ready",
    "statusMessage": ""
  },
  "owner": "Library",
  "readersGroup": null,
  "serviceEndpointProjectReferences": null,
  "type": "dockerregistry",
  "url": "https://hub.docker.com/"
}

Note: the "role": "8311e382-0749-4cb8-b61a-304f252e45ec" is the roleId for "AcrPush" role.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@triage-new-issues triage-new-issues bot removed the triage label Apr 2, 2020
@yonzhan yonzhan added Service Attention This issue is responsible by Azure service team. triage labels Apr 2, 2020
@triage-new-issues triage-new-issues bot removed the triage label Apr 2, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 2, 2020

devops

@rmaziarka
Copy link

@ngnmhieu you put this JSON in a separate file?

@ngnmhieu
Copy link
Author

@rmaziarka yes, and reference it in the command

az devops service-endpoint create --service-endpoint-configuration <PATH-TO-JSON>

@ghost
Copy link

ghost commented May 26, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @narula0781, @ashishonce, @romil07.

@azure-sdk azure-sdk added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Sep 24, 2020
@AaliAlikoski
Copy link

Any news on this? I am struggling with the same problem. So, an example of JSON needed for creating a service connection for ACR is what I am looking for.

@RakeshMohanMSFT RakeshMohanMSFT self-assigned this Dec 21, 2022
@RakeshMohanMSFT
Copy link
Contributor

RakeshMohanMSFT commented Dec 21, 2022

@AaliAlikoski @ngnmhieu Apologies for this long delay! but i believe you are looking for this.

{
  "data": {},
  "name": "issue1495registrysvcconnconfig",
  "type": "dockerregistry",
  "url": "issue1495registry.azurecr.io",
  "authorization": {
    "parameters": {
      "loginServer": "issue1495registry.azurecr.io",
      "role": "8311e382-0749-****",
      "scope": "/subscriptions/<subid>/resourceGroups/Issue1495/providers/Microsoft.ContainerRegistry/registries/issue1495registry",
      "servicePrincipalId": "beb836f5-8c90-***",
      "servicePrincipalKey": "tokenkey",
      "tenantId": "****-41af-91ab-2d7cd011db47"
    },
    "scheme": "ServicePrincipal"
  },
  "isShared": false,
  "isReady": true,
  "serviceEndpointProjectReferences": [
    {
      "projectReference": {
        "id": "****-98ac-f7b359a9cbe8",
        "name": "Issue1698Repo"
      },
      "name": "issue1495registrysvcconnconfig"
    }
  ]
}

More information here: https://github.com/Azure-Samples/Azure-CXP-Developer-Support/blob/main/AzureContainerRegistry/AzCLI/ACRServiceConnection/README.md

@RakeshMohanMSFT RakeshMohanMSFT added the issue-addressed This issue is addressed and ready to close. label Dec 21, 2022
@ghost
Copy link

ghost commented Dec 21, 2022

Hi @ngnmhieu. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

@ghost
Copy link

ghost commented Dec 29, 2022

Hi @ngnmhieu, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

@ghost ghost closed this as completed Dec 29, 2022
@arindam0310018
Copy link

arindam0310018 commented Jan 30, 2023

Hello @ngnmhieu, @yonzhan, @rmaziarka, @RakeshMohanMSFT,
I stumbled into this thread when I was looking for a solution to create DevOps Service Connection of type "Docker Registry Using Basic Authentication".
The MS Documentation https://learn.microsoft.com/en-us/azure/devops/cli/service-endpoint?view=azure-devops is not at all very clear.

Below is my config.JSON file -


{
"data": {},
"name": "AM-ACR-Srv-Connection",
"type": "dockerregistry",
"authorization": {
"parameters": {
"username": "ampocapplacr",
"password": "XXXXXXXXXXXXXXXXXXXXXXXXX",
"email": "mail2arindam2003@yahoo.com",
"registry": "https://ampocapplacr.azurecr.io"
},
"scheme": "UsernamePassword"
},
"isShared": false,
"isReady": true,
"serviceEndpointProjectReferences": [
{
"projectReference": {
"id": "36aaac58-e06f-47ed-8b98-003ad670ee3c",
"name": "AMCLOUD"
},
"name": "AM-ACR-Srv-Connection"
}
]
}


For More details, please refer below -
Blog:- https://dev.to/arindam0310018/create-docker-regisry-service-connection-using-devops-cli-1an8
Github:- https://github.com/arindam0310018/30-Jan-2023-DevOpsCLI__Create-Docker-Registry-Service-Connection

The Final output Screenshot is mentioned below:-
8

Hope this helps who ever visits this thread again.

Many Thanks
Regards, Arindam Mitra

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. DevOps issue-addressed This issue is addressed and ready to close. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

8 participants