Skip to content

Commit

Permalink
Merge pull request #22 from seesharprun/revamp
Browse files Browse the repository at this point in the history
Revamp
  • Loading branch information
seesharprun authored Dec 13, 2023
2 parents 11bb6a2 + a08dfd2 commit 3cac558
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 9 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md → .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to Quickstart: Azure Cosmos DB for NoSQL client library for .NET
# Contributing to Azure Samples

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
Expand Down Expand Up @@ -51,12 +51,12 @@ chances of your issue being dealt with quickly:
* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
causing the problem (line of code or commit)

You can file new issues by providing the above information at the corresponding repository's issues link: https://github.com/[organization-name]/[repository-name]/issues/new].
You can file new issues by providing the above information at the corresponding [repository's issues](../../../issues/new).

### <a name="submit-pr"></a> Submitting a Pull Request (PR)
Before you submit your Pull Request (PR) consider the following guidelines:

* Search the repository (https://github.com/[organization-name]/[repository-name]/pulls) for an open or closed PR
* Search the repository [pull requests](../../../pulls) for an open or closed PR
that relates to your submission. You don't want to duplicate effort.

* Make your changes in a new git fork:
Expand Down
41 changes: 41 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->

## Security

Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.**

Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).

If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.

## Preferred Languages

We prefer all communications to be in English.

## Policy

Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
2 changes: 1 addition & 1 deletion LICENSE.md → LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
SOFTWARE
1 change: 1 addition & 0 deletions infra/abbreviations.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"containerAppsEnv": "container-env",
"containerAppsApp": "container-app",
"cosmosDbAccount": "cosmos-db-nosql",
"openAiAccount": "openai",
"userAssignedIdentity": "ua-id"
}
35 changes: 35 additions & 0 deletions infra/core/ai/cognitive-services/account.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
metadata description = 'Creates an Azure Cognitive Services account.'

param name string
param location string = resourceGroup().location
param tags object = {}

@allowed([ 'OpenAI', 'ComputerVision', 'TextTranslation', 'CognitiveServices' ])
@description('Sets the kind of account.')
param kind string

@allowed([
'S0'
])
@description('SKU for the account. Defaults to "S0".')
param sku string = 'S0'

@description('Enables access from public networks. Defaults to true.')
param enablePublicNetworkAccess bool = true

resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
name: name
location: location
tags: tags
kind: kind
sku: {
name: sku
}
properties: {
customSubDomainName: name
publicNetworkAccess: enablePublicNetworkAccess ? 'Enabled' : 'Disabled'
}
}

output endpoint string = account.properties.endpoint
output name string = account.name
43 changes: 43 additions & 0 deletions infra/core/ai/cognitive-services/deployment.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
metadata description = 'Creates an Azure Cognitive Services deployment.'

param name string

@description('Name of the parent Azure Cognitive Services account.')
param parentAccountName string

@description('Name of the SKU for the deployment. Defaults to "Standard".')
param skuName string = 'Standard'

@description('Capacity of the SKU for the deployment. Defaults to 100.')
param skuCapacity int = 100

@description('Name of the model to use in the deployment.')
param modelName string

@description('Format of the model to use in the deployment.')
param modelFormat string

@description('Version of the model to use in the deployment.')
param modelVersion string

resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' existing = {
name: parentAccountName
}

resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = {
parent: account
name: name
sku: {
name: skuName
capacity: skuCapacity
}
properties: {
model: {
name: modelName
format: modelFormat
version: modelVersion
}
}
}

output name string = account.name
3 changes: 2 additions & 1 deletion infra/core/security/role/assignment.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ param principalId string
'Group'
'ServicePrincipal'
'User'
'None'
])
@description('Type of principal associated with the principal Id.')
param principalType string
Expand All @@ -22,7 +23,7 @@ resource assignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
properties: {
principalId: principalId
roleDefinitionId: roleDefinitionId
principalType: principalType
principalType: principalType != 'None' ? principalType : null
}
}

Expand Down
3 changes: 3 additions & 0 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,6 @@ output AZURE_USER_ASSIGNED_IDENTITY_NAME string = identity.outputs.name

// Security outputs
output AZURE_NOSQL_ROLE_DEFINITION_ID string = security.outputs.roleDefinitions.nosql

// Application environment variables
output AZURE_COSMOS_DB_NOSQL_ENDPOINT string = database.outputs.endpoint
9 changes: 5 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Quickstart: Azure Cosmos DB for NoSQL client library for .NET

This is a simple Blazor web application to illustrate common basic usage of Azure Cosmos DB for NoSQL's client library for .NET. This sample application accesses an existing account, database, and container using the [`Microsoft.Azure.Cosmos`](https://www.nuget.org/packages/Microsoft.Azure.Cosmos) and the [`Azure.Identity`](https://www.nuget.org/packages/Azure.Identity) libraries from NuGet. Modify the source code and leverage the Infrastructure as Code (IaC) Bicep assets to get up and running quickly.
This is a simple Blazor web application to illustrate common basic usage of Azure Cosmos DB for NoSQL's client library for .NET. This sample application accesses an existing account, database, and container using the [`Microsoft.Azure.Cosmos`](https://www.nuget.org/packages/Microsoft.Azure.Cosmos) and [`Azure.Identity`](https://www.nuget.org/packages/Azure.Identity) libraries from NuGet. Modify the source code and leverage the Infrastructure as Code (IaC) Bicep assets to get up and running quickly.

When you are finished, you will have a fully functional web application deployed to Azure.

Expand All @@ -19,15 +19,16 @@ The following prerequisites are required to use this application. Please ensure

### Quickstart

To learn how to get started with any template, follow the steps in [this quickstart] with this template (``).
To learn how to get started with any template, follow the steps in [this quickstart](https://learn.microsoft.com/azure/cosmos-db/nosql/quickstart-dotnet) with this template (`cosmos-db-nosql-dotnet-quickstart`).

This quickstart will show you how to authenticate on Azure, initialize using a template, provision infrastructure and deploy code on Azure via the following commands:

```bash
# Log in to azd. Only required once per-install.
azd auth login

# First-time project setup. Initialize a project in the current directory, using this template.
# First-time project setup. Initialize a project in the current directory, using this template.
# Omit the --template argument if you are running in a development container.
azd init --template cosmos-db-nosql-dotnet-quickstart

# Provision and deploy to Azure
Expand All @@ -51,7 +52,7 @@ Here's a high level architecture diagram that illustrates these components. Noti
%%{ init: { 'theme': 'base', 'themeVariables': { 'background': '#243A5E', 'primaryColor': '#50E6FF', 'primaryBorderColor': '#243A5E', 'tertiaryBorderColor': '#50E6FF', 'tertiaryColor': '#243A5E', 'fontFamily': 'Segoe UI', 'lineColor': '#FFFFFF', 'primaryTextColor': '#243A5E', 'tertiaryTextColor': '#FFFFFF' } }}%%
flowchart TB
subgraph web-app[Azure Container Apps]
app-framework([.NET 7 - Blazor])
app-framework([.NET 8 - Blazor])
end
subgraph cosmos-db[Azure Cosmos DB]
subgraph database-cosmicworks[Database: cosmicworks]
Expand Down

0 comments on commit 3cac558

Please sign in to comment.