Skip to content

Commit 5eade87

Browse files
Merge pull request KelvinTegelaar#1671 from johnduprey/dev
Azure Cloud Shell
2 parents 5db8164 + 39b4c8c commit 5eade87

File tree

1 file changed

+124
-27
lines changed

1 file changed

+124
-27
lines changed

src/views/cipp/CIPPSettings.js

Lines changed: 124 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import { Form } from 'react-final-form'
6969
import useConfirmModal from 'src/hooks/useConfirmModal'
7070
import { setCurrentTenant } from 'src/store/features/app'
7171
import {
72+
CippOffcanvas,
7273
CippCodeBlock,
7374
ModalService,
7475
StatusIcon,
@@ -821,7 +822,7 @@ const ExcludedTenantsSettings = () => {
821822
}
822823
const SecuritySettings = () => {
823824
const [listBackend, listBackendResult] = useLazyGenericGetRequestQuery()
824-
825+
const [visible, setVisible] = useState(false)
825826
return (
826827
<div>
827828
{listBackendResult.isUninitialized && listBackend({ path: 'api/ExecBackendURLs' })}
@@ -833,16 +834,16 @@ const SecuritySettings = () => {
833834
<CCardTitle>Resource Group</CCardTitle>
834835
</CCardHeader>
835836
<CCardBody>
836-
<CRow className="mb-3">
837+
<p>
837838
The Resource group contains all the CIPP resources in your tenant, except the SAM
838839
Application
839-
</CRow>
840+
</p>
840841
<a
841842
target={'_blank'}
842843
href={listBackendResult.data?.Results?.ResourceGroup}
843844
rel="noreferrer"
844845
>
845-
<CButton>Go to Resource Group</CButton>
846+
<CButton className="mb-3">Go to Resource Group</CButton>
846847
</a>
847848
</CCardBody>
848849
</CCard>
@@ -853,16 +854,16 @@ const SecuritySettings = () => {
853854
<CCardTitle>Key Vault</CCardTitle>
854855
</CCardHeader>
855856
<CCardBody>
856-
<CRow className="mb-3">
857+
<p>
857858
The keyvault allows you to check token information. By default you do not have
858859
access.
859-
</CRow>
860+
</p>
860861
<a
861862
target={'_blank'}
862863
href={listBackendResult.data?.Results?.KeyVault}
863864
rel="noreferrer"
864865
>
865-
<CButton>Go to Keyvault</CButton>
866+
<CButton className="mb-3">Go to Keyvault</CButton>
866867
</a>
867868
</CCardBody>
868869
</CCard>
@@ -873,16 +874,16 @@ const SecuritySettings = () => {
873874
<CCardTitle>Static Web App (Role Management)</CCardTitle>
874875
</CCardHeader>
875876
<CCardBody>
876-
<CRow className="mb-3">
877+
<p>
877878
The Static Web App role management allows you to invite other users to the
878879
application.
879-
</CRow>
880+
</p>
880881
<a
881882
target={'_blank'}
882883
href={listBackendResult.data?.Results?.SWARoles}
883884
rel="noreferrer"
884885
>
885-
<CButton>Go to Role Management</CButton>
886+
<CButton className="mb-3">Go to Role Management</CButton>
886887
</a>
887888
</CCardBody>
888889
</CCard>
@@ -895,15 +896,13 @@ const SecuritySettings = () => {
895896
<CCardTitle>Function App (Deployment Center)</CCardTitle>
896897
</CCardHeader>
897898
<CCardBody>
898-
<CRow className="mb-3">
899-
The Function App Deployment Center allows you to run updates on the API
900-
</CRow>
899+
<p>The Function App Deployment Center allows you to run updates on the API</p>
901900
<a
902901
target={'_blank'}
903902
href={listBackendResult.data?.Results?.FunctionDeployment}
904903
rel="noreferrer"
905904
>
906-
<CButton>Go to Function App Deployment Center</CButton>
905+
<CButton className="mb-3">Go to Function App Deployment Center</CButton>
907906
</a>
908907
</CCardBody>
909908
</CCard>
@@ -914,17 +913,17 @@ const SecuritySettings = () => {
914913
<CCardTitle>Function App (Configuration)</CCardTitle>
915914
</CCardHeader>
916915
<CCardBody>
917-
<CRow className="mb-3">
916+
<p>
918917
At the Function App Configuration you can check the status of the API access to
919918
your keyvault
920-
<a
921-
target={'_blank'}
922-
href={listBackendResult.data?.Results?.FunctionConfig}
923-
rel="noreferrer"
924-
>
925-
<CButton>Go to Function App Configuration</CButton>
926-
</a>
927-
</CRow>
919+
</p>
920+
<a
921+
target={'_blank'}
922+
href={listBackendResult.data?.Results?.FunctionConfig}
923+
rel="noreferrer"
924+
>
925+
<CButton className="mb-3">Go to Function App Configuration</CButton>
926+
</a>
928927
</CCardBody>
929928
</CCard>
930929
</CCol>
@@ -934,20 +933,118 @@ const SecuritySettings = () => {
934933
<CCardTitle>Function App (Overview)</CCardTitle>
935934
</CCardHeader>
936935
<CCardBody>
937-
<CRow className="mb-3">
938-
At the function App Overview, you can stop and start the backend API
939-
</CRow>
936+
<p>At the function App Overview, you can stop and start the backend API</p>
940937
<a
941938
target={'_blank'}
942939
href={listBackendResult.data?.Results?.FunctionApp}
943940
rel="noreferrer"
944941
>
945-
<CButton>Go to Function App Overview</CButton>
942+
<CButton className="mb-3">Go to Function App Overview</CButton>
946943
</a>
947944
</CCardBody>
948945
</CCard>
949946
</CCol>
950947
</CRow>
948+
<CRow className="mb-3">
949+
<CCol md={4}>
950+
<CCard className="h-100">
951+
<CCardHeader>
952+
<CCardTitle>Cloud Shell</CCardTitle>
953+
</CCardHeader>
954+
<CCardBody>
955+
<p>Launch an Azure Cloud Shell Window</p>
956+
<CLink
957+
onClick={() =>
958+
window.open(
959+
'https://shell.azure.com/powershell',
960+
'_blank',
961+
'toolbar=no,scrollbars=yes,resizable=yes,menubar=no,location=no,status=no',
962+
)
963+
}
964+
rel="noreferrer"
965+
>
966+
<CButton className="mb-3 me-3">Cloud Shell</CButton>
967+
</CLink>
968+
<CButton onClick={() => setVisible(true)} className="mb-3">
969+
Command Reference
970+
</CButton>
971+
</CCardBody>
972+
</CCard>
973+
</CCol>
974+
</CRow>
975+
<CippOffcanvas
976+
id="command-offcanvas"
977+
visible={visible}
978+
placement="end"
979+
className="cipp-offcanvas"
980+
hideFunction={() => setVisible(false)}
981+
title="Command Reference"
982+
>
983+
<h5 className="my-3">Function App Config</h5>
984+
<CippCodeBlock
985+
language="powershell"
986+
code={
987+
'$Function = Get-AzFunctionApp -ResourceGroupName ' +
988+
listBackendResult.data?.Results?.RGName +
989+
' -Name ' +
990+
listBackendResult.data?.Results?.FunctionName +
991+
'; $Function | select Name, Status, Location, Runtime, ApplicationSettings'
992+
}
993+
showLineNumbers={false}
994+
wrapLongLines={true}
995+
/>
996+
<h5 className="my-3">Function App Deployment</h5>
997+
<CippCodeBlock
998+
language="powershell"
999+
code={
1000+
'$FunctionDeployment = az webapp deployment source show --resource-group ' +
1001+
listBackendResult.data?.Results?.RGName +
1002+
' --name ' +
1003+
listBackendResult.data?.Results?.FunctionName +
1004+
' | ConvertFrom-Json; $FunctionDeployment | Select-Object repoUrl, branch, isGitHubAction, isManualIntegration, githubActionConfiguration'
1005+
}
1006+
showLineNumbers={false}
1007+
wrapLongLines={true}
1008+
/>
1009+
<h5 className="my-3">Watch Function Logs</h5>
1010+
<CippCodeBlock
1011+
language="powershell"
1012+
code={
1013+
'az webapp log tail --resource-group ' +
1014+
listBackendResult.data?.Results?.RGName +
1015+
' --name ' +
1016+
listBackendResult.data?.Results?.FunctionName
1017+
}
1018+
showLineNumbers={false}
1019+
wrapLongLines={true}
1020+
/>
1021+
<h5 className="my-3">Static Web App Config</h5>
1022+
<CippCodeBlock
1023+
language="powershell"
1024+
code={
1025+
'$StaticWebApp = Get-AzStaticWebApp -ResourceGroupName ' +
1026+
listBackendResult.data?.Results?.RGName +
1027+
' -Name ' +
1028+
listBackendResult.data?.Results?.SWAName +
1029+
'; $StaticWebApp | Select-Object Name, CustomDomain, DefaultHostname, RepositoryUrl'
1030+
}
1031+
showLineNumbers={false}
1032+
wrapLongLines={true}
1033+
/>
1034+
<h5 className="my-3">List CIPP Users</h5>
1035+
<CippCodeBlock
1036+
language="powershell"
1037+
code={
1038+
'Get-AzStaticWebAppUser -ResourceGroupName ' +
1039+
listBackendResult.data?.Results?.RGName +
1040+
' -Name ' +
1041+
listBackendResult.data?.Results?.SWAName +
1042+
' -AuthProvider all | Select-Object DisplayName, Role'
1043+
}
1044+
showLineNumbers={false}
1045+
wrapLongLines={true}
1046+
/>
1047+
</CippOffcanvas>
9511048
</>
9521049
</div>
9531050
)

0 commit comments

Comments
 (0)