Skip to content

Commit 1e3d10c

Browse files
committed
resole merge conflict
2 parents 87ff7c8 + 26983a8 commit 1e3d10c

File tree

6 files changed

+50
-48
lines changed

6 files changed

+50
-48
lines changed

articles/azure-functions/functions-reference-python.md

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,13 @@ When you deploy your project to a function app in Azure, the entire contents of
219219
To connect to Cosmos DB, first [create an account, database, and container](../cosmos-db/nosql/quickstart-portal.md). Then you may connect Functions to Cosmos DB using [trigger and bindings](functions-bindings-cosmosdb-v2.md), like this [example](functions-add-output-binding-cosmos-db-vs-code.md). You may also use the Python library for Cosmos DB, like so:
220220

221221
```python
222-
pip install azure-cosmos
222+
pip install azure-cosmos
223+
pip install aiohttp
223224

224-
from azure.cosmos import CosmosClient, exceptions
225+
from azure.cosmos.aio import CosmosClient
226+
from azure.cosmos import exceptions
225227
from azure.cosmos.partition_key import PartitionKey
228+
import asyncio
226229

227230
# Replace these values with your Cosmos DB connection information
228231
endpoint = "https://azure-cosmos-nosql.documents.azure.com:443/"
@@ -234,41 +237,42 @@ partition_key = "/partition_key"
234237
# Set the total throughput (RU/s) for the database and container
235238
database_throughput = 1000
236239

237-
# Initialize the Cosmos client
238-
client = CosmosClient(endpoint, key)
240+
# Helper function to get or create database and container
241+
async def get_or_create_container(client, database_id, container_id, partition_key):
239242

240-
# Create or get a reference to a database
241-
try:
242-
database = client.create_database_if_not_exists(id=database_id)
243+
database = await client.create_database_if_not_exists(id=database_id)
243244
print(f'Database "{database_id}" created or retrieved successfully.')
244245

245-
except exceptions.CosmosResourceExistsError:
246-
database = client.get_database_client(database_id)
247-
print('Database with id \'{0}\' was found'.format(database_id))
248-
249-
# Create or get a reference to a container
250-
try:
251-
container = database.create_container(id=container_id, partition_key=PartitionKey(path='/partitionKey'))
252-
print('Container with id \'{0}\' created'.format(container_id))
253-
254-
except exceptions.CosmosResourceExistsError:
255-
container = database.get_container_client(container_id)
256-
print('Container with id \'{0}\' was found'.format(container_id))
257-
258-
# Sample document data
259-
sample_document = {
260-
"id": "1",
261-
"name": "Doe Smith",
262-
"city": "New York",
263-
"partition_key": "NY"
264-
}
265-
266-
# Insert a document
267-
container.create_item(body=sample_document)
268-
269-
# Query for documents
270-
query = "SELECT * FROM c where c.id = 1"
271-
items = list(container.query_items(query, enable_cross_partition_query=True))
246+
container = await database.create_container_if_not_exists(id=container_id, partition_key=PartitionKey(path=partition_key))
247+
print(f'Container with id "{container_id}" created')
248+
249+
return container
250+
251+
async def create_products():
252+
async with CosmosClient(endpoint, credential=key) as client:
253+
container = await get_or_create_container(client, database_id, container_id, partition_key)
254+
for i in range(10):
255+
await container.upsert_item({
256+
'id': f'item{i}',
257+
'productName': 'Widget',
258+
'productModel': f'Model {i}'
259+
})
260+
261+
async def get_products():
262+
items = []
263+
async with CosmosClient(endpoint, credential=key) as client:
264+
container = await get_or_create_container(client, database_id, container_id, partition_key)
265+
async for item in container.read_all_items():
266+
items.append(item)
267+
return items
268+
269+
async def main():
270+
await create_products()
271+
products = await get_products()
272+
print(products)
273+
274+
if __name__ == "__main__":
275+
asyncio.run(main())
272276
```
273277

274278
::: zone pivot="python-mode-decorators"

articles/trusted-signing/TOC.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
items:
1111
- name: Signing Integrations with Trusted Signing
1212
href: how-to-signing-integrations.md
13-
- name: How-To
14-
items:
1513
- name: Sign CI Policies with Trusted Signing
1614
href: how-to-sign-ci-policy.md
1715
- name: Quickstart

articles/trusted-signing/faq.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ sections:
7171
FIPS 140-2 level 3 (mHSMs)
7272
- question: How to include the appropriate EKU for our certificates into the ELAM driver resources?
7373
answer: |
74-
- For information regarding ELAM driver config for Protected Anti-Malware Services, refer to the following guidance: "Beginning in 2022, all user mode anti-malware service binaries must be signed by Microsoft's Azure Code Sign signing service. The Trusted Signing issued Authenticode certificate for signing anti-malware binaries is updated every 30 days for security. To prevent the need to update the ELAM driver every time the certificate is updated, we recommend that anti-malware vendors include the Azure Code Sign PCA certificate TBS hash in the CertHash portion of the ELAM driver resource file info. Additionally, the anti-malware vendor must include their unique Trusted Signing EKU identity in the EKU field of the resource file info. The EKU identity will begin with the prefix *1.3.6.1.4.1.311.97.*."
74+
- For information regarding ELAM driver config for Protected Anti-Malware Services, refer to the following guidance: "Beginning in 2022, all user mode anti-malware service binaries must be signed by Microsoft's Trusted Signing signing service. The Trusted Signing issued Authenticode certificate for signing anti-malware binaries is updated every 30 days for security. To prevent the need to update the ELAM driver every time the certificate is updated, we recommend that anti-malware vendors include the Trusted Signing PCA certificate TBS hash in the CertHash portion of the ELAM driver resource file info. Additionally, the anti-malware vendor must include their unique Trusted Signing EKU identity in the EKU field of the resource file info. The EKU identity will begin with the prefix *1.3.6.1.4.1.311.97.*."
7575
- See the [PKI Repository](https://www.microsoft.com/pkiops/docs/repository.htm) page for the Microsoft ID Verified Code Signing PCA 2021 cert.
7676
- question: What happens if we run Trusted Signing binaries on a signed on machine that doesn't have the Trusted Signing update (especially binaries that are INTEGRITYCHECK-ed)?
7777
answer: |

articles/trusted-signing/how-to-sign-ci-policy.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,36 @@ Import-Module .\Az.CodeSigning.psd1
2929
```
3030
4. Optionally you can create a `metadata.json` file:
3131
```
32-
Endpoint "https://scus.codesigning.azure.net/"
33-
CodeSigningAccountName "youracsaccount"
34-
CertificateProfileName "youracscertprofile"
32+
"Endpoint": "https://xxx.codesigning.azure.net/"
33+
"TrustedSigningAccountName": "<Trusted Signing Account Name>",
34+
"CertificateProfileName": "<Certificate Profile Name>",
3535
```
3636
5. [Get the root certificate](/powershell/module/az.codesigning/get-azcodesigningrootcert) to be added to the trust store
3737
```
3838
Get-AzCodeSigningRootCert -AccountName TestAccount -ProfileName TestCertProfile -EndpointUrl https://xxx.codesigning.azure.net/ -Destination c:\temp\root.cer
3939
```
4040
Or using a metadata.json
4141
```
42-
Get-AzCodeSigningRootCert -MetadataFilePath C:\temp\metadata.sample.scus.privateci.json https://xxx.codesigning.azure.net/ -Destination c:\temp\root.cer
42+
Get-AzCodeSigningRootCert -MetadataFilePath C:\temp\metadata.json https://xxx.codesigning.azure.net/ -Destination c:\temp\root.cer
4343
```
4444
6. To get the EKU (Extended Key Usage) to insert into your policy:
4545
```
46-
Get-AzCodeSigningCustomerEku -AccountName acstestcanary -ProfileName acstestcanaryCert1 -EndpointUrl https://xxx.codesigning.azure.net/
46+
Get-AzCodeSigningCustomerEku -AccountName TestAccount -ProfileName TestCertProfile -EndpointUrl https://xxx.codesigning.azure.net/
4747
```
4848
Or
4949

5050
```
51-
Get-AzCodeSigningCustomerEku -MetadataFilePath C:\temp\metadata.sample.scus.privateci.json
51+
Get-AzCodeSigningCustomerEku -MetadataFilePath C:\temp\metadata.json
5252
```
5353
7. To sign your policy, you run the invoke command:
5454
```
55-
Invoke-AzCodeSigningCIPolicySigning -accountName acstestcanary -profileName acstestcanaryCert1 -endpointurl "https://xxx.codesigning.azure.net/" -Path C:\Temp\defaultpolicy.bin -Destination C:\Temp\defaultpolicy_signed.bin -TimeStamperUrl: http://timestamp.acs.microsoft.com
55+
Invoke-AzCodeSigningCIPolicySigning -accountName TestAccount -profileName TestCertProfile -endpointurl "https://xxx.codesigning.azure.net/" -Path C:\Temp\defaultpolicy.bin -Destination C:\Temp\defaultpolicy_signed.bin -TimeStamperUrl: http://timestamp.acs.microsoft.com
5656
```
5757

5858
Or use a `metadata.json` file and the following command:
5959

6060
```
61-
Invoke-AzCodeSigningCIPolicySigning -MetadataFilePath C:\temp\metadata.sample.scus.privateci.json -Path C:\Temp\defaultpolicy.bin -Destination C:\Temp\defaultpolicy_signed.bin -TimeStamperUrl: http://timestamp.acs.microsoft.com
61+
Invoke-AzCodeSigningCIPolicySigning -MetadataFilePath C:\temp\metadata.json -Path C:\Temp\defaultpolicy.bin -Destination C:\Temp\defaultpolicy_signed.bin -TimeStamperUrl: http://timestamp.acs.microsoft.com
6262
```
6363

6464
## Creating and Deploying a CI Policy

articles/trusted-signing/how-to-signing-integrations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ To sign using Trusted Signing, you need to provide the details of your Trusted S
7878
```
7979
{
8080
  "Endpoint": "<Code Signing Account Endpoint>",
81-
  "CodeSigningAccountName": "<Code Signing Account Name>",
81+
  "TrustedSigningAccountName": "<Trusted Signing Account Name>",
8282
  "CertificateProfileName": "<Certificate Profile Name>",
8383
  "CorrelationId": "<Optional CorrelationId*>"
8484
}

articles/trusted-signing/tutorial-assign-roles.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ Complete the following steps to assign roles in Trusted Signing.
3636
4. For more granular access control on the certificate profile level, you can use the Azure CLI to assign roles. The following commands can be used to assign the _Code Signing Certificate Profile Signer_ role to users/service principles to sign files.
3737
```
3838
az role assignment create --assignee <objectId of user/service principle>
39-
--role "Code Signing Certificate Profile Signer"
40-
--scope "/subscriptions/<subscriptionId>/resourceGroups/<resource-group-name>/providers/Microsoft.CodeSigning/codeSigningAccounts/<codesigning-account-name>/certificateProfiles/<profileName>"
39+
--role "Trusted Signing Certificate Profile Signer"
40+
--scope "/subscriptions/<subscriptionId>/resourceGroups/<resource-group-name>/providers/Microsoft.CodeSigning/trustedSigningAccounts/<trustedsigning-account-name>/certificateProfiles/<profileName>"
4141
```
4242

4343
## Related content

0 commit comments

Comments
 (0)