Spaces:
Runtime error
Runtime error
1- Github pushing files: | |
a) just delete any old git folder before create new repo | |
b) cd path/to/your/folder | |
c) git init | |
d) git add . | |
e) git commit -m "First Commit" | |
f) git remote add origin https://github.com/your_username/your_repository_name.git | |
g) git push -u origin master | |
2- In Azure: | |
a) go to create resource | |
b) select webapp (name it (resourcegroup,instance)), python 3.8 | |
c) pricing plan P1 | |
d) next, create | |
3- In Azure: | |
a) go to create resource | |
b) select azure bot and create | |
c) select same resourcegroup | |
d) next and create | |
e) go to resource --> configuration --> copy "MicrosoftAppID"/ "Pass" | |
f) open a new tab --> go to app services --> select the resource --> configuration --> new application setting | |
g) Name: MicrosoftAppID, Value: Pass | |
h) in the other tab go to Manage Password, click new secret "name it newsecret" 180 days, copy the value. | |
i) back to the other tab of webapp --> configuration --> new application setting, pass the value, name "MicrosoftAppPassword" | |
j) configuration --> new application setting --> SCM_DO_BUILD_DURING_DEPLOYMENT --> True (value) | |
k) save, and in the same page in general settings, | |
start up command "gunicorn --bind 0.0.0.0 --worker-class aiohttp.worker.GunicornWebWorker --timeout 600 app:APP" | |
##Container## | |
open azurecli and put the below commands: | |
# Get the resource group's ID | |
groupId=$(az group show --name myResourceGroup --query id --output tsv) | |
# Create the service principal | |
az ad sp create-for-rbac --scope $groupId --role Contributor --sdk-auth | |
save the output json credentials | |
create new container registery: | |
registryId=$(az acr show --name myRegistry --resource-group myResourceGroup --query id --output tsv) | |
#az acr show --name <registry-name> --resource-group <resource-group-name> --query id --output tsv | |
#az acr show --name myRegistry --resource-group myResourceGroup --query id --output tsv | |
lisitng: | |
acr list | |
az acr show | |
az acr list -o table | |
az acr show --name botapp2 --resource-group ahmedewispybot --query id --output tsv | |
and i got this, where is the register id? | |
/subscriptions/be2c9f65-de8d-4413-ab92-57d07fd5a256/resourceGroups/ahmedewispybot/providers/Microsoft.ContainerRegistry/registries/botapp2 | |
The output you received from the command is actually the registryId you were looking for. | |
So in your case, the registryId is: | |
/subscriptions/be2c9f65-de8d-4413-ab92-57d07fd5a256/resourceGroups/ahmedewispybot/providers/Microsoft.ContainerRegistry/registries/botapp2 | |
You can use this registryId directly in the role assignment command to assign a role to a service principal. | |
For example, if you want to assign the AcrPush role to a service principal with the client ID "abcd1234", you would use the following command: | |
az role assignment create \ | |
--assignee <ClientId> \ | |
--scope $registryId \ | |
--role AcrPush | |
<ClientId> from json file | |
code example of the role assignment: | |
az role assignment create --assignee abcd1234 --scope /subscriptions/be2c9f65-de8d-4413-ab92-57d07fd5a256/resourceGroups/ahmedewispybot/providers/Microsoft.ContainerRegistry/registries/botapp2 --role AcrPush | |
https://learn.microsoft.com/en-us/azure/container-instances/container-instances-github-action?tabs=userlevel | |