Skip to content

Commit d654e60

Browse files
authored
Merge pull request #143 from github-copilot-resources/feature/portal
Better UI for Azure deployments
2 parents 3249e6d + 7e86d63 commit d654e60

File tree

3 files changed

+473
-2
lines changed

3 files changed

+473
-2
lines changed

DEPLOYMENT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ Application will use a pre-built docker image hosted in GitHub registry: `ghcr.i
3636
3737
1. **Option 1 - Using a Personal Access Token in the Backend**:
3838

39-
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fgithub-copilot-resources%2Fcopilot-metrics-viewer%2Fmain%2Fazure-deploy%2Fwith-token%2Fazuredeploy.json)
39+
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fgithub-copilot-resources%2Fcopilot-metrics-viewer%2Fmain%2Fazure-deploy%2Fwith-token%2Fazuredeploy.json/uiFormDefinitionUri/https%3A%2F%2Fraw.githubusercontent.com%2Fgithub-copilot-resources%2Fcopilot-metrics-viewer%2Fmain%2Fazure-deploy%2Fwith-token%2Fportal.json)
4040

4141
2. **Option 2 - Using GitHub App Registration and GitHub Authentication**:
4242

4343
When using this method, [register your app in Github first](#github-app-registration).
4444

45-
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fgithub-copilot-resources%2Fcopilot-metrics-viewer%2Fmain%2Fazure-deploy%2Fwith-app-registration%2Fazuredeploy.json)
45+
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fgithub-copilot-resources%2Fcopilot-metrics-viewer%2Fmain%2Fazure-deploy%2Fwith-app-registration%2Fazuredeploy.json/uiFormDefinitionUri/https%3A%2F%2Fraw.githubusercontent.com%2Fgithub-copilot-resources%2Fcopilot-metrics-viewer%2Fmain%2Fazure-deploy%2Fwith-app-registration%2Fportal.json)
4646

4747
**Important**: After deploying Option 2, the redirect URI needs to be updated with the URL of the deployed container app.
4848

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2021-09-09/uiFormDefinition.schema.json",
3+
"view": {
4+
"kind": "Form",
5+
"properties": {
6+
"title": "Copilot Metrics Viewer deployment",
7+
"steps": [
8+
{
9+
"name": "basics",
10+
"label": "Basics",
11+
"elements": [
12+
{
13+
"name": "resourceScope",
14+
"type": "Microsoft.Common.ResourceScope",
15+
"location": {
16+
"resourceTypes": [
17+
"microsoft.resources/resourcegroups"
18+
]
19+
}
20+
},
21+
{
22+
"name": "basicsDescriptionTextBlock",
23+
"type": "Microsoft.Common.TextBlock",
24+
"options": {
25+
"text": "Copilot Metrics Viewer allows users to view usage metrics for GitHub copilot. The application is deployed without authentication, any user who can access the app can view the metrics.",
26+
"link": {
27+
"label": "https://aka.ms/missionlz",
28+
"uri": "https://aka.ms/missionlz"
29+
}
30+
}
31+
},
32+
{
33+
"name": "name",
34+
"type": "Microsoft.Common.TextBox",
35+
"label": "Name",
36+
"subLabel": "",
37+
"defaultValue": "copilot-metrics",
38+
"toolTip": "",
39+
"constraints": {
40+
"required": false,
41+
"regex": "",
42+
"validationMessage": "",
43+
"validations": []
44+
},
45+
"infoMessages": [],
46+
"visible": true
47+
},
48+
{
49+
"name": "location",
50+
"type": "Microsoft.Common.TextBox",
51+
"label": "Location",
52+
"subLabel": "",
53+
"defaultValue": "[[resourceGroup().location]",
54+
"toolTip": "The Azure Container App Location",
55+
"constraints": {
56+
"required": false,
57+
"regex": "",
58+
"validationMessage": "",
59+
"validations": []
60+
},
61+
"infoMessages": [],
62+
"visible": true
63+
},
64+
{
65+
"name": "ghAppSection",
66+
"label": "GitHub Application details",
67+
"type": "Microsoft.Common.Section",
68+
"elements": [
69+
{
70+
"name": "infoBoxLocation",
71+
"type": "Microsoft.Common.InfoBox",
72+
"options": {
73+
"text": "Follow documentation to create GitHub App registration https://github.com/github-copilot-resources/copilot-metrics-viewer/blob/main/DEPLOYMENT.md#github-app-registration",
74+
"style": "Info"
75+
}
76+
},
77+
{
78+
"name": "github-client-id",
79+
"type": "Microsoft.Common.PasswordBox",
80+
"label": {
81+
"password": "GitHub App Client Id",
82+
"confirmPassword": "Confirm client id"
83+
},
84+
"defaultValue": "",
85+
"toolTip": "GitHub Client ID from App Installation",
86+
"constraints": {
87+
"required": true,
88+
"regex": "",
89+
"validationMessage": "",
90+
"validations": []
91+
},
92+
"options": {
93+
"hideConfirmation": true
94+
},
95+
"visible": true
96+
},
97+
{
98+
"name": "github-client-secret",
99+
"type": "Microsoft.Common.PasswordBox",
100+
"label": {
101+
"password": "GitHub App Client Secret",
102+
"confirmPassword": "Confirm client secret"
103+
},
104+
"defaultValue": "",
105+
"toolTip": "GitHub Client Secret (key) from App Registration",
106+
"constraints": {
107+
"required": true,
108+
"regex": "",
109+
"validationMessage": "",
110+
"validations": []
111+
},
112+
"options": {
113+
"hideConfirmation": true
114+
},
115+
"visible": true
116+
}
117+
]
118+
},
119+
{
120+
"name": "ghSection",
121+
"label": "GitHub Configuration",
122+
"type": "Microsoft.Common.Section",
123+
"elements": [
124+
{
125+
"name": "scope",
126+
"type": "Microsoft.Common.DropDown",
127+
"label": "Select the scope of the application",
128+
"toolTip": "Organization or Enterprise.",
129+
"placeholder": "",
130+
"multiselect": false,
131+
"selectAll": false,
132+
"multiLine": false,
133+
"constraints": {
134+
"required": true,
135+
"allowedValues": [
136+
{
137+
"value": "org",
138+
"label": "Organization"
139+
},
140+
{
141+
"value": "ent",
142+
"label": "Enterprise"
143+
}
144+
]
145+
}
146+
},
147+
{
148+
"name": "github-organization",
149+
"type": "Microsoft.Common.TextBox",
150+
"label": "Github organization slug",
151+
"subLabel": "",
152+
"defaultValue": "",
153+
"toolTip": "GitHub Organization - provide only if application-scope is organization",
154+
"constraints": {
155+
"required": "[equals(steps('basics').ghSection.scope, 'org')]"
156+
},
157+
"infoMessages": [],
158+
"visible": "[equals(steps('basics').ghSection.scope, 'org')]"
159+
},
160+
{
161+
"name": "github-enterprise",
162+
"type": "Microsoft.Common.TextBox",
163+
"label": "Github enterprise slug",
164+
"subLabel": "",
165+
"defaultValue": "",
166+
"toolTip": "GitHub Enterprise - provide only if application-scope is enterprise",
167+
"constraints": {
168+
"required": "[equals(steps('basics').ghSection.scope, 'ent')]"
169+
},
170+
"visible": "[equals(steps('basics').ghSection.scope, 'ent')]"
171+
}
172+
]
173+
},
174+
{
175+
"name": "dockerSection",
176+
"label": "Docker Image",
177+
"type": "Microsoft.Common.Section",
178+
"elements": [
179+
{
180+
"name": "metrics-viewer-docker-image",
181+
"type": "Microsoft.Common.TextBox",
182+
"label": "Metrics-viewer-docker-image",
183+
"subLabel": "",
184+
"defaultValue": "ghcr.io/github-copilot-resources/copilot-metrics-viewer-with-proxy:latest",
185+
"toolTip": "Docker image for metrics viewer - use default or replace with your own",
186+
"constraints": {
187+
"required": false,
188+
"validations": []
189+
},
190+
"infoMessages": [],
191+
"visible": true
192+
}
193+
]
194+
},
195+
{
196+
"name": "networkSection",
197+
"label": "Networking",
198+
"type": "Microsoft.Common.Section",
199+
"elements": [
200+
{
201+
"name": "infoBoxLocation",
202+
"type": "Microsoft.Common.InfoBox",
203+
"options": {
204+
"text": "Without a subnet the application is going to be publicly available",
205+
"style": "Warning"
206+
}
207+
},
208+
{
209+
"name": "subnetId",
210+
"type": "Microsoft.Common.TextBox",
211+
"label": "Subnet Id",
212+
"subLabel": "",
213+
"defaultValue": "",
214+
"toolTip": "Subnet ID (at least /23) for the managed environment when deploying app without public access",
215+
"constraints": {
216+
"required": false,
217+
"regex": "",
218+
"validationMessage": "",
219+
"validations": []
220+
},
221+
"infoMessages": [],
222+
"visible": true
223+
}
224+
]
225+
}
226+
]
227+
}
228+
]
229+
},
230+
"outputs": {
231+
"kind": "ResourceGroup",
232+
"location": "[steps('basics').resourceScope.location.name]",
233+
"resourceGroupId": "[steps('basics').resourceScope.resourceGroup.id]",
234+
"parameters": {
235+
"name": "[steps('basics').name]",
236+
"location": "[steps('basics').location]",
237+
"github-client-id": "[steps('basics').ghAppSection.github-client-id]",
238+
"github-client-secret": "[steps('basics').ghAppSection.github-client-secret]",
239+
"github-organization": "[steps('basics').ghSection.github-organization]",
240+
"github-enterprise": "[steps('basics').ghSection.github-enterprise]",
241+
"metrics-viewer-docker-image": "[steps('basics').dockerSection.metrics-viewer-docker-image]",
242+
"subnetId": "[steps('basics').networkSection.subnetId]"
243+
}
244+
}
245+
}
246+
}

0 commit comments

Comments
 (0)