Skip to content

Instantly share code, notes, and snippets.

View JodyArthur's full-sized avatar

JodyArthur JodyArthur

View GitHub Profile
@JodyArthur
JodyArthur / PowerShell script.txt
Last active March 29, 2024 20:03
PowerShell script for extracting users and permissions to a CSV file.
function Export-TeamsList
{
param (
$ExportPath
)
process{
Connect-PnPOnline -Scopes "Group.Read.All","User.ReadBasic.All"
$accesstoken =Get-PnPAccessToken
$MTeams = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken"} -Uri "https://graph.microsoft.com/beta/groups?`$filter=resourceProvisioningOptions/any(c:c+eq+`'Team`')" -Method Get
$TeamsList = @()
```
use schema ASTRA_DEMO2;
select count(*) from (
select
record_metadata:key:a as a,
record_metadata:key:b as b
from ASTRA_DEMO2.ASTRA_DEMO2.PERSISTENT___TERRAFORMSNOWFLAKEAWS_ASTRACDC_DATA_D7FFD03C_F4D3_4C5C_9E4E_704C82EC3ECF_PUPPIES_MYTABLE_PARTITION_0_447233800 natural full outer join ASTRA_DEMO2.ASTRA_DEMO2.PERSISTENT___TERRAFORMSNOWFLAKEAWS_ASTRACDC_DATA_D7FFD03C_F4D3_4C5C_9E4E_704C82EC3ECF_PUPPIES_MYTABLE_PARTITION_1_447233799 natural full outer join ASTRA_DEMO2.ASTRA_DEMO2.PERSISTENT___TERRAFORMSNOWFLAKEAWS_ASTRACDC_DATA_D7FFD03C_F4D3_4C5C_9E4E_704C82EC3ECF_PUPPIES_MYTABLE_PARTITION_2_447233798);
```
insert into puppies.mytable (b , a ) VALUES ( 'test', 'hello');
insert into puppies.mytable (b , a ) VALUES ( 'test', 'there');
insert into puppies.mytable (b , a ) VALUES ( 'test', pulsar);
insert into puppies.mytable (b , a ) VALUES ( 'test', snowflake);
```
```
create user "tf-snow" rsa_public_key='REDACTED'
default_role=public must_change_password=FALSE;
alter user "tf-snow" set default_warehouse = astra_demo;
use role accountadmin;
-- Create a Snowflake role with the privileges to work with the connector.
create role kafka_connector_role_1;
resources.tf
```
terraform {
required_providers {
snowflake = {
source = "Snowflake-Labs/snowflake"
version = "0.34.0"
}
astra = {
Source = "datastax/astra"
.env:
```
export SNOWFLAKE_ACCOUNT="MHB84648"
export TF_LOG="INFO"
export SNOWFLAKE_USER="USERNAME"
export SNOWFLAKE_PASSWORD="PASSWORD"
export ASTRA_API_TOKEN="AstraCS:REDACTED"
```
```
terraform {
required_providers {
snowflake = {
source = "Snowflake-Labs/snowflake"
version = "0.34.0"
}
astra = {
source = "datastax/astra"
version = "2.1.0-rc9"
$ ls astra/
1.cql 2.cql scb.zip
$ docker run -ti -v $PWD/astra:/astra -e ASTRA_TOKEN=AstraCS:xyz:123 --rm kijanowski/docker-cqlsh-astra
...
Found cql scripts; executing them...
Executing /astra/1.cql
ks system_schema system data_endpoint_auth ...
$ ls astra/
scb.zip
$ docker run -ti -v $PWD/astra:/astra -e ASTRA_TOKEN=AstraCS:xyz:123 --rm kijanowski/docker-cqlsh-astra
...
Connected to cndb at 127.0.0.1:9042.
[cqlsh 6.8.0 | Cassandra 4.0.0.6816 | CQL spec 3.4.5 | Native protocol v4]
Use HELP for help.
token@cqlsh> describe keyspaces
ks system_schema system data_endpoint_auth ...
$ curl https://downloads.datastax.com/enterprise/cqlsh-astra.tar.gz -o cqlsh.tar.gz && tar zxf cqlsh.tar.gz
$ sudo apt-get update && sudo apt-get install -y python3
$ /cqlsh-astra/bin/cqlsh -b /path/to/secure-connect-bundle.zip -u token -p AstraCS:xyz:123