Skip to content

Commit

Permalink
Merge pull request #58 from microsoftgraph/dkershaw10-doc-updates
Browse files Browse the repository at this point in the history
Minor changes to the docs
  • Loading branch information
dkershaw10 authored Nov 18, 2023
2 parents 1ed44a9 + 0019b97 commit 8abab51
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
Binary file added docs/VS code graph types in bicep.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 16 additions & 10 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ To use the private preview you'll need to install [Bicep tools](https://learn.mi
If you already have the Bicep extension for VS Code (or Visual Studio) make sure that you have the latest version (v0.21.1 or later).
Earlier versions do not have the Microsoft Graph Bicep Extension.

## Creating a Bicep template
If you are new to [Bicep](https://learn.microsoft.com/azure/azure-resource-manager/bicep/overview?tabs=bicep), we strongly recommend that you start by getting familiar with Bicep by trying out the [Bicep quickstarts](https://learn.microsoft.com//azure/azure-resource-manager/bicep/quickstart-create-bicep-use-visual-studio-code?tabs=CLI) and [Bicep tutorials](https://learn.microsoft.com/azure/azure-resource-manager/bicep/learn-bicep).

## Creating a Bicep template with Microsoft Graph Bicep types

To get the benefit of intellisense and auto-complete for the Microsoft Graph Bicep types, you need to enable some experimental features in the Bicep config. Follow the steps in this [Bicep configuration topic](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-config), to create a Bicep config file, and add:

Expand All @@ -24,19 +26,23 @@ When you create a Bicep template, add the following statement, to make Microsoft
import '[email protected]'
```

Now, when creating a Bicep resource, the available Microsoft.Graph resource types will show up:
Now, when creating a Bicep resource, the available Microsoft.Graph resource types will show up.

![image](./VS%20code%20graph%20types%20in%20bicep.jpg)

* [applications](../generated/microsoftgraph/microsoft.graph/beta/types.md#resource-microsoftgraphapplicationsbeta)
* [servicePrincipals](../generated/microsoftgraph/microsoft.graph/beta/types.md#resource-microsoftgraphserviceprincipalsbeta)
* [groups](../generated/microsoftgraph/microsoft.graph/beta/types.md#resource-microsoftgraphgroupsbeta)
* [appRoleAssignedTo](../generated/microsoftgraph/microsoft.graph/beta/types.md#resource-microsoftgraphapproleassignedtobeta)
* [oauth2PermissionGrants](../generated/microsoftgraph/microsoft.graph/beta/types.md#resource-microsoftgraphoauth2permissiongrantsbeta)
| Bicep type definitions | Microsoft Graph API (beta) reference |
|--------------|-----------|
| [applications](../generated/microsoftgraph/microsoft.graph/beta/types.md#resource-microsoftgraphapplicationsbeta) | [application resource](https://learn.microsoft.com/graph/api/resources/application?view=graph-rest-beta) |
| [servicePrincipals](../generated/microsoftgraph/microsoft.graph/beta/types.md#resource-microsoftgraphserviceprincipalsbeta) | [servicePrincipal resource](https://learn.microsoft.com/graph/api/resources/serviceprincipal?view=graph-rest-beta) |
| [groups](../generated/microsoftgraph/microsoft.graph/beta/types.md#resource-microsoftgraphgroupsbeta) | [group resource](https://learn.microsoft.com/graph/api/resources/group?view=graph-rest-beta) |
| [appRoleAssignedTo](../generated/microsoftgraph/microsoft.graph/beta/types.md#resource-microsoftgraphapproleassignedtobeta) | [appRoleAssignment resource](https://learn.microsoft.com/graph/api/resources/approleassignment?view=graph-rest-beta) |
| [oauth2PermissionGrants](../generated/microsoftgraph/microsoft.graph/beta/types.md#resource-microsoftgraphoauth2permissiongrantsbeta) | [oauth2PermissionGrant resource](https://learn.microsoft.com/graph/api/resources/oauth2permissiongrant?view=graph-rest-beta) |

## Deploying Bicep templates

Bicep templates can be deployed using Azure CLI or PowerShell.
Bicep templates can be deployed using [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) or [Azure PowerShell](https://learn.microsoft.com/powershell/azure/install-azure-powershell).

Deployment will only work for tenants that have been enrolled to the private preview.
> **NOTE**: Deployment will only work for tenants that have been enrolled to the private preview.
## Next steps

Expand All @@ -47,4 +53,4 @@ We've created some quick-start templates to get you started.
3. [Create a security group with owners and members](../quickstart-templates/security-group-create-with-owners-and-members/)
4. [Assign an Azure role to a security group](../quickstart-templates/security-group-assign-azure-role/)

Feel free to contribute and share your own samples too!
Feel free to contribute and share your own samples too, by creating some PRs for template examples!
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

This template allows you to create a client application and a resource application, along with their service principals.

* The client application is created with an optional key credential. The key can be passed in as a parameter. [Get The Certificate Key](https://learn.microsoft.com/en-us/graph/applications-how-to-add-certificate?tabs=http#get-the-certificate-key) mentions the steps to get the certificate key
* The client application is created with an optional key credential. The key can be passed in as a parameter. [Get The Certificate Key](https://learn.microsoft.com/en-us/graph/applications-how-to-add-certificate?tabs=http#get-the-certificate-key) mentions the steps to get the certificate key for a self-signed certificate. Here's a basic script:

```powershell
$certname = "AppRegTestCert"
$cert = New-SelfSignedCertificate -Subject "CN=$certname" -CertStoreLocation "Cert:\CurrentUser\My" -KeyExportPolicy Exportable -KeySpec Signature -KeyLength 2048 -KeyAlgorithm RSA -HashAlgorithm SHA256
Export-Certificate -Cert $cert -FilePath "$certname.cer" // Exports PUBLIC cert
[convert]::ToBase64String((Get-Content "$certname.cer" -Encoding byte)) | Out-File -FilePath "20231004.$certname.txt"
```

* The resource application is created with an optional app role. The id for the app role can be passed in as a parameter.

You can deploy the template with the following Azure CLI command (replace `<resource-group>`, `<app-role-id>` and `<cert-key>` with the necessary values for your deployment):
Expand Down

0 comments on commit 8abab51

Please sign in to comment.