Skip to content

Commit 3cac558

Browse files
authored
Merge pull request #22 from seesharprun/revamp
Revamp
2 parents 11bb6a2 + a08dfd2 commit 3cac558

File tree

9 files changed

+134
-9
lines changed

9 files changed

+134
-9
lines changed

CONTRIBUTING.md .github/CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to Quickstart: Azure Cosmos DB for NoSQL client library for .NET
1+
# Contributing to Azure Samples
22

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

54-
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].
54+
You can file new issues by providing the above information at the corresponding [repository's issues](../../../issues/new).
5555

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

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

6262
* Make your changes in a new git fork:

.github/SECURITY.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
2+
3+
## Security
4+
5+
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).
6+
7+
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.
8+
9+
## Reporting Security Issues
10+
11+
**Please do not report security vulnerabilities through public GitHub issues.**
12+
13+
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).
14+
15+
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).
16+
17+
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).
18+
19+
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:
20+
21+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22+
* Full paths of source file(s) related to the manifestation of the issue
23+
* The location of the affected source code (tag/branch/commit or direct URL)
24+
* Any special configuration required to reproduce the issue
25+
* Step-by-step instructions to reproduce the issue
26+
* Proof-of-concept or exploit code (if possible)
27+
* Impact of the issue, including how an attacker might exploit the issue
28+
29+
This information will help us triage your report more quickly.
30+
31+
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.
32+
33+
## Preferred Languages
34+
35+
We prefer all communications to be in English.
36+
37+
## Policy
38+
39+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
40+
41+
<!-- END MICROSOFT SECURITY.MD BLOCK -->

LICENSE.md LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE
21+
SOFTWARE

infra/abbreviations.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"containerAppsEnv": "container-env",
44
"containerAppsApp": "container-app",
55
"cosmosDbAccount": "cosmos-db-nosql",
6+
"openAiAccount": "openai",
67
"userAssignedIdentity": "ua-id"
78
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
metadata description = 'Creates an Azure Cognitive Services account.'
2+
3+
param name string
4+
param location string = resourceGroup().location
5+
param tags object = {}
6+
7+
@allowed([ 'OpenAI', 'ComputerVision', 'TextTranslation', 'CognitiveServices' ])
8+
@description('Sets the kind of account.')
9+
param kind string
10+
11+
@allowed([
12+
'S0'
13+
])
14+
@description('SKU for the account. Defaults to "S0".')
15+
param sku string = 'S0'
16+
17+
@description('Enables access from public networks. Defaults to true.')
18+
param enablePublicNetworkAccess bool = true
19+
20+
resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
21+
name: name
22+
location: location
23+
tags: tags
24+
kind: kind
25+
sku: {
26+
name: sku
27+
}
28+
properties: {
29+
customSubDomainName: name
30+
publicNetworkAccess: enablePublicNetworkAccess ? 'Enabled' : 'Disabled'
31+
}
32+
}
33+
34+
output endpoint string = account.properties.endpoint
35+
output name string = account.name
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
metadata description = 'Creates an Azure Cognitive Services deployment.'
2+
3+
param name string
4+
5+
@description('Name of the parent Azure Cognitive Services account.')
6+
param parentAccountName string
7+
8+
@description('Name of the SKU for the deployment. Defaults to "Standard".')
9+
param skuName string = 'Standard'
10+
11+
@description('Capacity of the SKU for the deployment. Defaults to 100.')
12+
param skuCapacity int = 100
13+
14+
@description('Name of the model to use in the deployment.')
15+
param modelName string
16+
17+
@description('Format of the model to use in the deployment.')
18+
param modelFormat string
19+
20+
@description('Version of the model to use in the deployment.')
21+
param modelVersion string
22+
23+
resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' existing = {
24+
name: parentAccountName
25+
}
26+
27+
resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = {
28+
parent: account
29+
name: name
30+
sku: {
31+
name: skuName
32+
capacity: skuCapacity
33+
}
34+
properties: {
35+
model: {
36+
name: modelName
37+
format: modelFormat
38+
version: modelVersion
39+
}
40+
}
41+
}
42+
43+
output name string = account.name

infra/core/security/role/assignment.bicep

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ param principalId string
1212
'Group'
1313
'ServicePrincipal'
1414
'User'
15+
'None'
1516
])
1617
@description('Type of principal associated with the principal Id.')
1718
param principalType string
@@ -22,7 +23,7 @@ resource assignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
2223
properties: {
2324
principalId: principalId
2425
roleDefinitionId: roleDefinitionId
25-
principalType: principalType
26+
principalType: principalType != 'None' ? principalType : null
2627
}
2728
}
2829

infra/main.bicep

+3
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,6 @@ output AZURE_USER_ASSIGNED_IDENTITY_NAME string = identity.outputs.name
119119

120120
// Security outputs
121121
output AZURE_NOSQL_ROLE_DEFINITION_ID string = security.outputs.roleDefinitions.nosql
122+
123+
// Application environment variables
124+
output AZURE_COSMOS_DB_NOSQL_ENDPOINT string = database.outputs.endpoint

readme.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Quickstart: Azure Cosmos DB for NoSQL client library for .NET
22

3-
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.
3+
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.
44

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

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

2020
### Quickstart
2121

22-
To learn how to get started with any template, follow the steps in [this quickstart] with this template (``).
22+
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`).
2323

2424
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:
2525

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

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

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

0 commit comments

Comments
 (0)